mirror of
https://github.com/showdownjs/showdown.git
synced 2024-03-22 13:30:55 +08:00
chore: cleanup code and comments
This commit is contained in:
parent
169cbe8e2d
commit
062e465902
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.
|
@ -28,19 +28,6 @@ showdown.subParser('codeSpans', function (text, options, globals) {
|
||||||
|
|
||||||
text = globals.converter._dispatch('codeSpans.before', text, options, globals);
|
text = globals.converter._dispatch('codeSpans.before', text, options, globals);
|
||||||
|
|
||||||
/*
|
|
||||||
text = text.replace(/
|
|
||||||
(^|[^\\]) // Character before opening ` can't be a backslash
|
|
||||||
(`+) // $2 = Opening run of `
|
|
||||||
( // $3 = The code block
|
|
||||||
[^\r]*?
|
|
||||||
[^`] // attacklab: work around lack of lookbehind
|
|
||||||
)
|
|
||||||
\2 // Matching closer
|
|
||||||
(?!`)
|
|
||||||
/gm, function(){...});
|
|
||||||
*/
|
|
||||||
|
|
||||||
if (typeof(text) === 'undefined') {
|
if (typeof(text) === 'undefined') {
|
||||||
text = '';
|
text = '';
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,7 @@ showdown.subParser('encodeAmpsAndAngles', function (text, options, globals) {
|
||||||
text = text.replace(/&(?!#?[xX]?(?:[0-9a-fA-F]+|\w+);)/g, '&');
|
text = text.replace(/&(?!#?[xX]?(?:[0-9a-fA-F]+|\w+);)/g, '&');
|
||||||
|
|
||||||
// Encode naked <'s
|
// Encode naked <'s
|
||||||
text = text.replace(/<(?![a-z\/?\$!])/gi, '<');
|
text = text.replace(/<(?![a-z\/?$!])/gi, '<');
|
||||||
|
|
||||||
text = globals.converter._dispatch('encodeAmpsAndAngles.after', text, options, globals);
|
text = globals.converter._dispatch('encodeAmpsAndAngles.after', text, options, globals);
|
||||||
return text;
|
return text;
|
||||||
|
|
|
@ -14,7 +14,7 @@ showdown.subParser('encodeBackslashEscapes', function (text, options, globals) {
|
||||||
text = globals.converter._dispatch('encodeBackslashEscapes.before', text, options, globals);
|
text = globals.converter._dispatch('encodeBackslashEscapes.before', text, options, globals);
|
||||||
|
|
||||||
text = text.replace(/\\(\\)/g, showdown.helper.escapeCharactersCallback);
|
text = text.replace(/\\(\\)/g, showdown.helper.escapeCharactersCallback);
|
||||||
text = text.replace(/\\([`*_{}\[\]()>#+-.!~])/g, showdown.helper.escapeCharactersCallback);
|
text = text.replace(/\\([`*_{}\[\]()>#+.!~=-])/g, showdown.helper.escapeCharactersCallback);
|
||||||
|
|
||||||
text = globals.converter._dispatch('encodeBackslashEscapes.after', text, options, globals);
|
text = globals.converter._dispatch('encodeBackslashEscapes.after', text, options, globals);
|
||||||
return text;
|
return text;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/**
|
/**
|
||||||
* Within tags -- meaning between < and > -- encode [\ ` * _] so they
|
* Within tags -- meaning between < and > -- encode [\ ` * _ ~ =] so they
|
||||||
* don't conflict with their use in Markdown for code, italics and strong.
|
* don't conflict with their use in Markdown for code, italics and strong.
|
||||||
*/
|
*/
|
||||||
showdown.subParser('escapeSpecialCharsWithinTagAttributes', function (text, options, globals) {
|
showdown.subParser('escapeSpecialCharsWithinTagAttributes', function (text, options, globals) {
|
||||||
|
@ -13,8 +13,7 @@ showdown.subParser('escapeSpecialCharsWithinTagAttributes', function (text, opti
|
||||||
text = text.replace(regex, function (wholeMatch) {
|
text = text.replace(regex, function (wholeMatch) {
|
||||||
return wholeMatch
|
return wholeMatch
|
||||||
.replace(/(.)<\/?code>(?=.)/g, '$1`')
|
.replace(/(.)<\/?code>(?=.)/g, '$1`')
|
||||||
//tag = showdown.helper.escapeCharacters(tag, '\\`*_', false);
|
.replace(/([\\`*_~=])/g, showdown.helper.escapeCharactersCallback);
|
||||||
.replace(/([\\`*_ ~=])/g, showdown.helper.escapeCharactersCallback);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
text = globals.converter._dispatch('escapeSpecialCharsWithinTagAttributes.after', text, options, globals);
|
text = globals.converter._dispatch('escapeSpecialCharsWithinTagAttributes.after', text, options, globals);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user