script.jsscrapbox.PopupMenu.addButton({
title: "#",
onClick: text => text
.split("\n")
.map((line, index) => line.replace(/^(\s*)/, `$1${index + 1}. `))
.join("\n")
});
line.trim() === ""
script.js.oldscrapbox.PopupMenu.addButton({
title: "#",
onClick: (text) => {
let indentLevels = {};
return text.split("\n")
.map((line) => {
let indent = line.match(/^\s*/)[0];
indentLevels[indent] = (indentLevels[indent] || 0) + 1;
return line.replace(/^(\s*)/, `$1${indentLevels[indent]}. `);
})
.join("\n");
},
});