mirror of
https://github.com/showdownjs/showdown.git
synced 2024-03-22 13:30:55 +08:00
parent
32800a14a8
commit
61929bb262
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
|
||||
*/
|
||||
showdown.helper.regexes = {
|
||||
asteriskDashAndColon: /([*_:])/g
|
||||
asteriskDashAndColon: /([*_:~])/g
|
||||
};
|
||||
|
|
|
@ -1,19 +1,20 @@
|
|||
// url allowed chars [a-z\d_.~:/?#[]@!$&'()*+,;=-]
|
||||
|
||||
var simpleURLRegex = /\b(((https?|ftp|dict):\/\/|www\.)[^'">\s]+\.[^'">\s]+)()(?=\s|$)(?!["<>])/gi,
|
||||
simpleURLRegex2 = /\b(((https?|ftp|dict):\/\/|www\.)[^'">\s]+\.[^'">\s]+?)([.!?,()\[\]]?)(?=\s|$)(?!["<>])/gi,
|
||||
//simpleURLRegex3 = /\b(((https?|ftp):\/\/|www\.)[a-z\d.-]+\.[a-z\d_.~:/?#\[\]@!$&'()*+,;=-]+?)([.!?()]?)(?=\s|$)(?!["<>])/gi,
|
||||
delimUrlRegex = /<(((https?|ftp|dict):\/\/|www\.)[^'">\s]+)()>/gi,
|
||||
var simpleURLRegex = /([*~_]+|\b)(((https?|ftp|dict):\/\/|www\.)[^'">\s]+?\.[^'">\s]+?)()(\1)?(?=\s|$)(?!["<>])/gi,
|
||||
simpleURLRegex2 = /([*~_]+|\b)(((https?|ftp|dict):\/\/|www\.)[^'">\s]+\.[^'">\s]+?)([.!?,()\[\]])?(\1)?(?=\s|$)(?!["<>])/gi,
|
||||
delimUrlRegex = /()<(((https?|ftp|dict):\/\/|www\.)[^'">\s]+)()>()/gi,
|
||||
simpleMailRegex = /(^|\s)(?:mailto:)?([A-Za-z0-9!#$%&'*+-/=?^_`{|}~.]+@[-a-z0-9]+(\.[-a-z0-9]+)*\.[a-z]+)(?=$|\s)/gmi,
|
||||
delimMailRegex = /<()(?:mailto:)?([-.\w]+@[-a-z0-9]+(\.[-a-z0-9]+)*\.[a-z]+)>/gi,
|
||||
|
||||
replaceLink = function (options) {
|
||||
'use strict';
|
||||
|
||||
return function (wm, link, m2, m3, trailingPunctuation) {
|
||||
return function (wm, leadingMagicChars, link, m2, m3, trailingPunctuation, trailingMagicChars) {
|
||||
link = link.replace(showdown.helper.regexes.asteriskDashAndColon, showdown.helper.escapeCharactersCallback);
|
||||
var lnkTxt = link,
|
||||
append = '',
|
||||
target = '';
|
||||
target = '',
|
||||
lmc = leadingMagicChars || '',
|
||||
tmc = trailingMagicChars || '';
|
||||
if (/^www\./i.test(link)) {
|
||||
link = link.replace(/^www\./i, 'http://www.');
|
||||
}
|
||||
|
@ -23,7 +24,7 @@ var simpleURLRegex = /\b(((https?|ftp|dict):\/\/|www\.)[^'">\s]+\.[^'">\s]+)()(
|
|||
if (options.openLinksInNewWindow) {
|
||||
target = ' target="¨E95Eblank"';
|
||||
}
|
||||
return '<a href="' + link + '"' + target + '>' + lnkTxt + '</a>' + append;
|
||||
return lmc + '<a href="' + link + '"' + target + '>' + lnkTxt + '</a>' + append + tmc;
|
||||
};
|
||||
},
|
||||
|
||||
|
|
|
@ -8,9 +8,11 @@ showdown.subParser('italicsAndBold', function (text, options, globals) {
|
|||
// called "catastrophic backtrace". Ominous!
|
||||
|
||||
function parseInside (txt, left, right) {
|
||||
/*
|
||||
if (options.simplifiedAutoLink) {
|
||||
txt = showdown.subParser('simplifiedAutoLinks')(txt, options, globals);
|
||||
}
|
||||
*/
|
||||
return left + txt + right;
|
||||
}
|
||||
|
||||
|
|
|
@ -19,9 +19,9 @@ showdown.subParser('spanGamut', function (text, options, globals) {
|
|||
// Must come after anchors, because you can use < and >
|
||||
// delimiters in inline links like [this](<url>).
|
||||
text = showdown.subParser('autoLinks')(text, options, globals);
|
||||
text = showdown.subParser('simplifiedAutoLinks')(text, options, globals);
|
||||
text = showdown.subParser('italicsAndBold')(text, options, globals);
|
||||
text = showdown.subParser('strikethrough')(text, options, globals);
|
||||
text = showdown.subParser('simplifiedAutoLinks')(text, options, globals);
|
||||
|
||||
// we need to hash HTML tags inside spans
|
||||
text = showdown.subParser('hashHTMLSpans')(text, options, globals);
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
<p><a href="http://www.foobar.com/blegh#**foobar**bazinga">http://www.foobar.com/blegh#**foobar**bazinga</a></p>
|
|
@ -0,0 +1 @@
|
|||
http://www.foobar.com/blegh#**foobar**bazinga
|
Loading…
Reference in New Issue
Block a user