Markdown形式でページのURLをコピーするPageMenu
code:script.js
scrapbox.PageMenu.addItem({
title: "Copy link for Markdown",
onClick: () => {
const title = scrapbox.Page.title
.replaceAll(" ", "_")
.replace(//?#\{}^|<>/g, (char) => encodeURIComponent(char)); navigator.clipboard
.writeText([${scrapbox.Page.title}](https://${location.hostname}/${scrapbox.Project.name}/${title}${location.hash}))
.catch(e=>alert(${e.name}: ${e.message}));
},
});