From 89ddeec2a0b4cf67994427dbe2bb58f4af30a4c2 Mon Sep 17 00:00:00 2001 From: Tony Brix Date: Fri, 11 Aug 2023 21:46:54 -0600 Subject: [PATCH] docs: fix older versions in demo (#2934) --- build-docs.js | 12 +++++------- docs/_document.html | 3 ++- docs/css/shared.css | 26 ++++++++++++++++++++++++++ docs/demo/demo.css | 16 ++++++++-------- docs/demo/demo.js | 4 ++++ docs/demo/index.html | 5 +++-- docs/demo/worker.js | 38 +++++++++++++++++++++++--------------- 7 files changed, 71 insertions(+), 33 deletions(-) create mode 100644 docs/css/shared.css diff --git a/build-docs.js b/build-docs.js index 4d3c851873..2c7d499950 100644 --- a/build-docs.js +++ b/build-docs.js @@ -42,15 +42,13 @@ async function build(currentDir, tmpl) { await build(filename, tmpl); } else { // console.log('Reading file ' + filename); - let buffer = await readFile(filename); + let html = await readFile(filename, 'utf8'); const parsed = parse(filename); if (parsed.ext === '.md' && isUppercase(parsed.name)) { - const html = marked.parse(buffer.toString('utf8')); - buffer = Buffer.from(tmpl + const mdHtml = marked.parse(html); + html = tmpl .replace('', getTitle(parsed.name)) - .replace('', html), - 'utf8' - ); + .replace('', mdHtml); parsed.ext = '.html'; parsed.name = parsed.name.toLowerCase(); delete parsed.base; @@ -60,7 +58,7 @@ async function build(currentDir, tmpl) { // console.log('Ensure directory ' + dirname(outfile)); await mkdir(dirname(outfile), { recursive: true }); console.log('Writing file ' + outfile); - await writeFile(outfile, buffer, { mode }); + await writeFile(outfile, html, { mode }); } } } diff --git a/docs/_document.html b/docs/_document.html index b8e9356634..b76588947c 100644 --- a/docs/_document.html +++ b/docs/_document.html @@ -4,11 +4,12 @@ <!--{{title}}-->Marked Documentation + - Marked Demo + - -