mirror of
https://github.com/showdownjs/showdown.git
synced 2024-03-22 13:30:55 +08:00
fix(spanGamut): code spans are hashed after parsing
Code spans are now hashed after parsing which means extensions that listen to spanGamut events no longer need to worry about escaping "custom" magic chars inside code spans. Closes #464
This commit is contained in:
parent
21194c8a03
commit
f4f63c5c39
BIN
dist/showdown.js
vendored
BIN
dist/showdown.js
vendored
Binary file not shown.
BIN
dist/showdown.js.map
vendored
BIN
dist/showdown.js.map
vendored
Binary file not shown.
BIN
dist/showdown.min.js
vendored
BIN
dist/showdown.min.js
vendored
Binary file not shown.
BIN
dist/showdown.min.js.map
vendored
BIN
dist/showdown.min.js.map
vendored
Binary file not shown.
|
@ -37,7 +37,9 @@ showdown.subParser('codeSpans', function (text, options, globals) {
|
||||||
c = c.replace(/^([ \t]*)/g, ''); // leading whitespace
|
c = c.replace(/^([ \t]*)/g, ''); // leading whitespace
|
||||||
c = c.replace(/[ \t]*$/g, ''); // trailing whitespace
|
c = c.replace(/[ \t]*$/g, ''); // trailing whitespace
|
||||||
c = showdown.subParser('encodeCode')(c, options, globals);
|
c = showdown.subParser('encodeCode')(c, options, globals);
|
||||||
return m1 + '<code>' + c + '</code>';
|
c = m1 + '<code>' + c + '</code>';
|
||||||
|
c = showdown.subParser('hashHTMLSpans')(c, options, globals);
|
||||||
|
return c;
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -51,6 +51,7 @@ showdown.subParser('unhashHTMLSpans', function (text, options, globals) {
|
||||||
var num = RegExp.$1;
|
var num = RegExp.$1;
|
||||||
repText = repText.replace('¨C' + num + 'C', globals.gHtmlSpans[num]);
|
repText = repText.replace('¨C' + num + 'C', globals.gHtmlSpans[num]);
|
||||||
if (limit === 10) {
|
if (limit === 10) {
|
||||||
|
console.error('maximum nesting of 10 spans reached!!!');
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
++limit;
|
++limit;
|
||||||
|
|
|
@ -4,3 +4,4 @@
|
||||||
<p>A backtick-delimited string in a code span: <code>`foo`</code></p>
|
<p>A backtick-delimited string in a code span: <code>`foo`</code></p>
|
||||||
<p>Please don't use any <code><blink></code> tags.</p>
|
<p>Please don't use any <code><blink></code> tags.</p>
|
||||||
<p><code>&#8212;</code> is the decimal-encoded equivalent of <code>&mdash;</code>.</p>
|
<p><code>&#8212;</code> is the decimal-encoded equivalent of <code>&mdash;</code>.</p>
|
||||||
|
<p>this <code>inline **code** has ___magic___</code> chars</p>
|
||||||
|
|
|
@ -10,3 +10,5 @@ A backtick-delimited string in a code span: `` `foo` ``
|
||||||
Please don't use any `<blink>` tags.
|
Please don't use any `<blink>` tags.
|
||||||
|
|
||||||
`—` is the decimal-encoded equivalent of `—`.
|
`—` is the decimal-encoded equivalent of `—`.
|
||||||
|
|
||||||
|
this `inline **code** has ___magic___` chars
|
||||||
|
|
Loading…
Reference in New Issue
Block a user