diff options
author | Menix <menix@tilde.institute> | 2022-07-21 18:54:02 +0000 |
---|---|---|
committer | Menix <menix@tilde.institute> | 2022-07-21 18:54:02 +0000 |
commit | f0e9a91b55b6f90d9ddbe7347293be27bf58a5ed (patch) | |
tree | 0edc124b1ccd7e5f5ceb1037b1aa4c53e38f8fae /public_md/build.js | |
parent | 32c74c9d9984c6da8644c50c2945eb5d4c3bea24 (diff) | |
download | tilde-notes-master.tar.gz |
Diffstat (limited to 'public_md/build.js')
-rw-r--r-- | public_md/build.js | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/public_md/build.js b/public_md/build.js index 2dddfc0..abc0320 100644 --- a/public_md/build.js +++ b/public_md/build.js @@ -3,6 +3,17 @@ const fs = require("fs"); const path = require("path"); md = new MarkdownIt(); +const html_header = ` + <!doctype HTML> + <html><head> + <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@exampledev/new.css@1/new.min.css"> + <link rel="stylesheet" href="https://fonts.xz.style/serve/inter.css"> + </head><body> + ` +const html_footer = ` + </body></html> + ` + const walkSync = (inputdir, outputdir, callback) => { const files = fs.readdirSync(inputdir); @@ -26,7 +37,7 @@ function fileHandler (filepath, outputdir, stats) { }); outputpath = outputpath.replace(/\.md$/i, '.html'); - const html = md.render(buf.toString()); + const html = html_header + md.render(buf.toString()) + html_footer; fs.writeFile(outputpath, html, (err) => { if (err) console.log(err); console.log("Successfully Written to: " + outputpath); |