improve commonmark compliance

This commit is contained in:
Estevão Soares dos Santos 2022-11-15 04:31:13 +00:00
parent 150c4c36cb
commit 9dab0826c6
5 changed files with 7 additions and 6 deletions

View File

@ -33,6 +33,9 @@ showdown.subParser('makehtml.encodeAmpsAndAngles', function (text, options, glob
// Encode >
text = text.replace(/>/g, '>');
// encode "
text = text.replace(/"/g, '"');
let afterEvent = new showdown.Event('makehtml.encodeAmpsAndAngles.onEnd', text);
afterEvent
.setOutput(text)

View File

@ -22,7 +22,7 @@ showdown.subParser('makehtml.escapeSpecialCharsWithinTagAttributes', function (t
text = startEvent.output;
// Build a regex to find HTML tags.
let tags = /<\/?[a-z\d_:-]+(?:[\s]+[\s\S]+?)?>/gi,
let tags = /<\/?[a-z\d_:-]+(?:\s+[\s\S]+?)?>/gi,
comments = /<!(--(([^>-]|-[^>])([^-]|-[^-])*)--)>/gi;
text = text.replace(tags, function (wholeMatch) {

View File

@ -309,7 +309,7 @@
if (/^¨K\d+K$/.test(nLastLine) || /^\s*$/gm.test(nLastLine)) {
// everything before --- or === is a block or empty line, so it's a false positive
prepend += nPrepend;
prepend += nPrepend + '\n\n';
headingText = '';
} else {
// the last line is something else... so let's look at the line before that

View File

@ -1,5 +1,3 @@
<h1 id="some-header">some header</h1>
<h1 id="some-header-with--chars">some header with &amp;+$,/:;=?@\"#{}|^¨¿?:~[]`゠=…‥『』〝〟「」\*(){}()[]【】%.。,¡!' chars</h1>
<h1 id="some-header-with--chars">some header with &amp;+$,/:;=?@&quot;#{}|^¨¿?:~[]`゠=…‥『』〝〟「」\*(){}()[]【】%.。,¡!' chars</h1>
<h1 id="another-header--with--chars">another header &gt; with &lt; chars</h1>

View File

@ -1,2 +1,2 @@
<h1 id="/prefix/some-header">some header</h1>
<h1 id="/prefix/another-!-#$%&/()=?»@£§{[]}«--header">another !"#$%&amp;/()=?»@£§{[]}«' header</h1>
<h1 id="/prefix/another-!-#$%&/()=?»@£§{[]}«--header">another !&quot;#$%&amp;/()=?»@£§{[]}«' header</h1>