import 'https://scrapbox.io/api/code/ci7lus/ricapitolare/svg.js' if(!isMobile()) { import('/api/code/shokai/音声入力Menu/script.js'); } scrapbox.PopupMenu.addButton({ title : 'Format the tweet', onClick : text => { const convertContent = (content, indent) => { const replaced = content .replace(/(.*?)<\/a>/g, '[$1 $2]') .replace(/
/g, `\n${indent}`); const elem = document.createElement('div'); elem.innerHTML = replaced; return indent + elem.innerText; } const tweetRegex = /(?[\t ]*)(?.*)<\/p>—(?.*)(?)<\/blockquote>[\n\t ]*<\/script>/; const match = text.match(tweetRegex); if(!match) return; const {spaces, content, author, link} = match.groups; const ind = `${spaces}>`; return text.replace(tweetRegex, convertContent(content, ind) + '\n' + convertContent(`\t—${author} ${link}`, ind)); } }) import {runScrapboxLint} from "/api/code/hata6502/scrapbox-lint/index.js"; runScrapboxLint({});