diff --git a/nbs/_quarto.yml b/nbs/_quarto.yml index ab3c7fd..98b5fe9 100644 --- a/nbs/_quarto.yml +++ b/nbs/_quarto.yml @@ -1,5 +1,6 @@ project: type: website + post-render: post_render.ts resources: - "*.txt" - "*.html" diff --git a/nbs/post_render.ts b/nbs/post_render.ts new file mode 100644 index 0000000..e5fd519 --- /dev/null +++ b/nbs/post_render.ts @@ -0,0 +1,7 @@ +// Copy generated md outputs to spec-compliant `.html.md` names (see the Proposal section in index.qmd). +const dir = Deno.env.get("QUARTO_PROJECT_OUTPUT_DIR")!; +for await (const f of Deno.readDir(dir)) { + if (!f.name.endsWith(".md") || f.name.endsWith(".html.md") || f.name === "README.md") continue; + const dst = `${dir}/${f.name.replace(/(-commonmark)?\.md$/, ".html.md")}`; + try { await Deno.stat(dst); } catch { await Deno.copyFile(`${dir}/${f.name}`, dst); } +}