settings
code:style.css
atype="hashTag"{
display: inline-block;
padding: 2px 8px;
margin: 0 8px 10px 0;
background: #fff;
color: #f27e48;
font-size: 0.8em;
border: 1px solid #f27e48;
border-radius: 3px;
transition: .3s;
-webkit-transform: scale(1);
transform: scale(1);
}
atype="hashTag":hover{
-webkit-transform: scale(1.1);
transform: scale(1.1);
}
/* ** <ーこれに蛍光のラインを足す */
.level-1{
background: linear-gradient(transparent 70%, #ABDCD6 70%);
}
code:script.js
scrapbox.PopupMenu.addButton({
title : 'Embed Tweet',
onClick : text => {
const convertContent = (content, indent) => {
const replaced = content
.replace(/<a href="(https?:.*?)">(.*?)<\/a>/g, '$1 $2')
.replace(/<br>/g, \n${indent});
const elem = document.createElement('div');
elem.innerHTML = replaced;
return indent + elem.innerText;
}
const tweetRegex = /(?<spaces>\t *)<blockquote\w"\-= *><p\w"\-= *>(?<content>.*)<\/p>&mdash;(?<author>.*)(?<link><a.*>)<\/blockquote>\n\t *<script.*?><\/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));
}
})