mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2025-12-17 06:20:12 +01:00
Add simple rendering of Markdown directive metadata to demo web page for easier diagnostics.
This commit is contained in:
parent
7c2391b021
commit
9640be90a4
2 changed files with 18 additions and 1 deletions
|
|
@ -36,6 +36,7 @@
|
||||||
"unicorn/prefer-query-selector": "off",
|
"unicorn/prefer-query-selector": "off",
|
||||||
"unicorn/prefer-add-event-listener": "off",
|
"unicorn/prefer-add-event-listener": "off",
|
||||||
"no-console": "off",
|
"no-console": "off",
|
||||||
|
"no-invalid-this": "off",
|
||||||
"no-shadow": "off",
|
"no-shadow": "off",
|
||||||
"no-var": "off"
|
"no-var": "off"
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -33,6 +33,22 @@
|
||||||
.replace(/>/g, ">");
|
.replace(/>/g, ">");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Renders directive metadata
|
||||||
|
function handleDirective(directive) {
|
||||||
|
const content = directive.content;
|
||||||
|
delete directive.content;
|
||||||
|
if (content) {
|
||||||
|
this.tag("<blockquote>");
|
||||||
|
}
|
||||||
|
this.tag("<code>");
|
||||||
|
this.raw(this.encode(JSON.stringify(directive)));
|
||||||
|
this.tag("</code>");
|
||||||
|
this.raw(content);
|
||||||
|
if (content) {
|
||||||
|
this.tag("</blockquote>");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Renders Markdown to HTML
|
// Renders Markdown to HTML
|
||||||
function render(markdown) {
|
function render(markdown) {
|
||||||
const match = /^\?renderer=([a-z-]+)$/.exec(window.location.search);
|
const match = /^\?renderer=([a-z-]+)$/.exec(window.location.search);
|
||||||
|
|
@ -55,7 +71,7 @@
|
||||||
const compileOptions = {
|
const compileOptions = {
|
||||||
"allowDangerousHtml": true,
|
"allowDangerousHtml": true,
|
||||||
"htmlExtensions": [
|
"htmlExtensions": [
|
||||||
micromarkHtml.directiveHtml(),
|
micromarkHtml.directiveHtml({ "*": handleDirective }),
|
||||||
micromarkHtml.gfmAutolinkLiteralHtml(),
|
micromarkHtml.gfmAutolinkLiteralHtml(),
|
||||||
micromarkHtml.gfmFootnoteHtml(),
|
micromarkHtml.gfmFootnoteHtml(),
|
||||||
micromarkHtml.gfmTableHtml(),
|
micromarkHtml.gfmTableHtml(),
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue