<%* function getTitleAndAuthor(l) { l = l.replace("Reading Notes | <<", "").split(">>"); return { title: l[0], authors: l[1] } }
let file = app.workspace.getActiveFile() let content = await app.vault.read(file) let lines = content.split("\n"); let titleAndAuthor = getTitleAndAuthor(lines.shift());
notes = lines.join("\n").split("-------------------")
let output = # ${titleAndAuthor.title}${titleAndAuthor.authors ? "\n### " + titleAndAuthor.authors : ""}\n\n\n
;
for (let i = 0; i < notes.length; i++) {
if (notes[i]) {
note = notes[i].split("Page No.: ").pop().split("【Note】")[0];
noteLines = note.split("\n")
noteLines.shift();
if (noteLines[noteLines.length - 1].length == 0) {
noteLines.pop();
}
output += - ${noteLines.join("\n\t")}\n\n
;
}
}
app.vault.modify(file, output); %>