mirror of
https://github.com/showdownjs/showdown.git
synced 2024-03-22 13:30:55 +08:00
improve commonmark compliance
This commit is contained in:
parent
150c4c36cb
commit
9dab0826c6
|
@ -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)
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
<h1 id="some-header">some header</h1>
|
||||
|
||||
<h1 id="some-header-with--chars">some header with &+$,/:;=?@\"#{}|^¨¿?:~[]`゠=…‥『』〝〟「」\*(){}()[]【】%.。,¡!!' chars</h1>
|
||||
|
||||
<h1 id="some-header-with--chars">some header with &+$,/:;=?@"#{}|^¨¿?:~[]`゠=…‥『』〝〟「」\*(){}()[]【】%.。,¡!!' chars</h1>
|
||||
<h1 id="another-header--with--chars">another header > with < chars</h1>
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
<h1 id="/prefix/some-header">some header</h1>
|
||||
<h1 id="/prefix/another-!-#$%&/()=?»@£§{[]}«--header">another !"#$%&/()=?»@£§{[]}«' header</h1>
|
||||
<h1 id="/prefix/another-!-#$%&/()=?»@£§{[]}«--header">another !"#$%&/()=?»@£§{[]}«' header</h1>
|
||||
|
|
Loading…
Reference in New Issue
Block a user