Update demo web page to remove recognized front matter from rendered HTML output.

This commit is contained in:
David Anson 2025-06-02 22:07:21 -07:00
parent f956dd089f
commit dda89f90d4
2 changed files with 2 additions and 0 deletions

View file

@ -2,6 +2,7 @@
export { applyFixes, getVersion } from "markdownlint"; export { applyFixes, getVersion } from "markdownlint";
export { lint as lintSync } from "markdownlint/sync"; export { lint as lintSync } from "markdownlint/sync";
export { frontMatterRe } from "markdownlint/helpers";
export { compile, parse, postprocess, preprocess } from "micromark"; export { compile, parse, postprocess, preprocess } from "micromark";
export { directive, directiveHtml } from "micromark-extension-directive"; export { directive, directiveHtml } from "micromark-extension-directive";
export { gfmAutolinkLiteral, gfmAutolinkLiteralHtml } from "micromark-extension-gfm-autolink-literal"; export { gfmAutolinkLiteral, gfmAutolinkLiteralHtml } from "micromark-extension-gfm-autolink-literal";

View file

@ -49,6 +49,7 @@
// Renders Markdown to HTML // Renders Markdown to HTML
function render(markdown) { function render(markdown) {
markdown = markdown.replace(markdownlint.frontMatterRe, "");
const match = /^\?renderer=([a-z-]+)$/.exec(globalThis.location.search); const match = /^\?renderer=([a-z-]+)$/.exec(globalThis.location.search);
const renderer = match ? match[1] : "micromark"; const renderer = match ? match[1] : "micromark";
if (renderer === "markdown-it") { if (renderer === "markdown-it") {