added: command to download notes as html files

This commit is contained in:
quenousimporte 2023-11-06 11:49:45 +01:00
parent 997ad9c5ed
commit 105e1d31f5
1 changed files with 19 additions and 1 deletions

20
main.js
View File

@ -216,10 +216,14 @@ var commands = [
action: downloadnotewithsubs
},
{
hint: "Download all notes (zip file)",
hint: "Download all notes (md files in zip archive)",
action: downloadnotes,
shortcut: "ctrl+shift+S"
},
{
hint: "Download all notes (html files in zip archive)",
action: downloadhtmlnotes
},
{
hint: "Download all notes (json file)",
action: downloadnotesjson
@ -1067,6 +1071,20 @@ function downloadnotes()
});
}
function downloadhtmlnotes()
{
var zip = new JSZip();
localdata.forEach(note =>
{
zip.file(getfilename(note.title).replace(".md", ".html"), md2html(note.content));
});
zip.generateAsync({type:"blob"})
.then(function(content)
{
saveAs(content, "notes-html-" + timestamp() + ".zip");
});
}
function headerandtext(note)
{
var content = note.content;