mirror of
https://github.com/showdownjs/showdown.git
synced 2024-03-22 13:30:55 +08:00
refactor: add colon to escaped chars in images and anchors
This commit is contained in:
parent
87b1422064
commit
e862e242f7
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.
|
@ -376,5 +376,5 @@ if (typeof(console) === 'undefined') {
|
||||||
* We declare some common regexes to improve performance
|
* We declare some common regexes to improve performance
|
||||||
*/
|
*/
|
||||||
showdown.helper.regexes = {
|
showdown.helper.regexes = {
|
||||||
asteriskAndDash: /([*_])/g
|
asteriskDashAndColon: /([*_:])/g
|
||||||
};
|
};
|
||||||
|
|
|
@ -33,14 +33,14 @@ showdown.subParser('anchors', function (text, options, globals) {
|
||||||
}
|
}
|
||||||
|
|
||||||
//url = showdown.helper.escapeCharacters(url, '*_', false); // replaced line to improve performance
|
//url = showdown.helper.escapeCharacters(url, '*_', false); // replaced line to improve performance
|
||||||
url = url.replace(showdown.helper.regexes.asteriskAndDash, showdown.helper.escapeCharactersCallback);
|
url = url.replace(showdown.helper.regexes.asteriskDashAndColon, showdown.helper.escapeCharactersCallback);
|
||||||
|
|
||||||
var result = '<a href="' + url + '"';
|
var result = '<a href="' + url + '"';
|
||||||
|
|
||||||
if (title !== '' && title !== null) {
|
if (title !== '' && title !== null) {
|
||||||
title = title.replace(/"/g, '"');
|
title = title.replace(/"/g, '"');
|
||||||
//title = showdown.helper.escapeCharacters(title, '*_', false); // replaced line to improve performance
|
//title = showdown.helper.escapeCharacters(title, '*_', false); // replaced line to improve performance
|
||||||
title = title.replace(showdown.helper.regexes.asteriskAndDash, showdown.helper.escapeCharactersCallback);
|
title = title.replace(showdown.helper.regexes.asteriskDashAndColon, showdown.helper.escapeCharactersCallback);
|
||||||
result += ' title="' + title + '"';
|
result += ' title="' + title + '"';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -56,16 +56,16 @@ showdown.subParser('images', function (text, options, globals) {
|
||||||
altText = altText
|
altText = altText
|
||||||
.replace(/"/g, '"')
|
.replace(/"/g, '"')
|
||||||
//altText = showdown.helper.escapeCharacters(altText, '*_', false);
|
//altText = showdown.helper.escapeCharacters(altText, '*_', false);
|
||||||
.replace(showdown.helper.regexes.asteriskAndDash, showdown.helper.escapeCharactersCallback);
|
.replace(showdown.helper.regexes.asteriskDashAndColon, showdown.helper.escapeCharactersCallback);
|
||||||
//url = showdown.helper.escapeCharacters(url, '*_', false);
|
//url = showdown.helper.escapeCharacters(url, '*_', false);
|
||||||
url = url.replace(showdown.helper.regexes.asteriskAndDash, showdown.helper.escapeCharactersCallback);
|
url = url.replace(showdown.helper.regexes.asteriskDashAndColon, showdown.helper.escapeCharactersCallback);
|
||||||
var result = '<img src="' + url + '" alt="' + altText + '"';
|
var result = '<img src="' + url + '" alt="' + altText + '"';
|
||||||
|
|
||||||
if (title) {
|
if (title) {
|
||||||
title = title
|
title = title
|
||||||
.replace(/"/g, '"')
|
.replace(/"/g, '"')
|
||||||
//title = showdown.helper.escapeCharacters(title, '*_', false);
|
//title = showdown.helper.escapeCharacters(title, '*_', false);
|
||||||
.replace(showdown.helper.regexes.asteriskAndDash, showdown.helper.escapeCharactersCallback);
|
.replace(showdown.helper.regexes.asteriskDashAndColon, showdown.helper.escapeCharactersCallback);
|
||||||
result += ' title="' + title + '"';
|
result += ' title="' + title + '"';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user