Spice
https://lh3.googleusercontent.com/a-/AOh14Gi4JK_QZaXw661zteEkENeiT53gNiJv_nCM0U7HlA=s96-c#.png
東京でソフトウェアエンジニアとして働いています。
JS,TSが中心です。
気が向いた時にOSS活動することもあります。
scrapboxにメモしてある程度ボリュームができたものはブログに移動しています。
各種アカウント
code:script.js
scrapbox.PageMenu.addItem({
title: 'Copy this Page As Markdown',
onClick: e => {
let markdownText = ''
for (let index = 0; index < scrapbox.Page.lines.length; index++) {
markdownText += transLine(index, scrapbox.Page.linesindex.text) + '\n' }
let preEl = document.createElement('pre')
preEl.id = 'us_markdown_copy_area'
preEl.style = 'position: absolute; top: -1px; width: 1px; height: 1px;'
preEl.innerHTML = markdownText
document.body.appendChild(preEl)
document.getSelection().selectAllChildren(preEl)
console.log(document.execCommand('copy'))
document.body.removeChild(preEl)
function transLine (i, text) {
if (i === 0) return text
if (text.trim() === '') return ''
let spaceMatches = text.match(/^\s+/g)
let preText = (spaceMatches ? ' '.repeat(spaceMatches0.length * 2) : '') + '- ' return preText + text.trim()
}
}
})