FIX: Updated Markdown-js to include my latest FIX from upstream:

https://github.com/evilstreak/markdown-js/pull/164
This commit is contained in:
Robin Ward 2014-01-21 11:04:49 -05:00
parent 2684f20ada
commit 0a8432645d

View file

@ -681,6 +681,9 @@
isEmpty = MarkdownHelpers.isEmpty,
inline_until_char = DialectHelpers.inline_until_char;
// A robust regexp for matching URLs. Thakns: https://gist.github.com/dperini/729294
var urlRegexp = /(?:(?:https?|ftp):\/\/)(?:\S+(?::\S*)?@)?(?:(?!10(?:\.\d{1,3}){3})(?!127(?:\.\d{1,3}){3})(?!169\.254(?:\.\d{1,3}){2})(?!192\.168(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z\u00a1-\uffff0-9]+-?)*[a-z\u00a1-\uffff0-9]+)(?:\.(?:[a-z\u00a1-\uffff0-9]+-?)*[a-z\u00a1-\uffff0-9]+)*(?:\.(?:[a-z\u00a1-\uffff]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?/i.source;
/**
* Gruber dialect
*
@ -1222,7 +1225,7 @@
//
// First attempt to use a strong URL regexp to catch things like parentheses. If it misses, use the
// old one.
var m = text.match( /^!\[(.*?)][ \t]*\(((?:https?:(?:\/{1,3}|[a-z0-9%])|www\d{0,3}[.])(?:[^\s()<>]+|\([^\s()<>]+\))+(?:\([^\s()<>]+\)|[^`!()\[\]{};:'".,<>?«»“”‘’\s]))\)([ \t])*(["'].*["'])?/ ) ||
var m = text.match(new RegExp("^!\\[(.*?)][ \\t]*\\((" + urlRegexp + ")\\)([ \\t])*([\"'].*[\"'])?")) ||
text.match( /^!\[(.*?)\][ \t]*\([ \t]*([^")]*?)(?:[ \t]+(["'])(.*?)\3)?[ \t]*\)/ );
if ( m ) {
@ -1324,10 +1327,16 @@
return [ consumed, link ];
}
m = text.match(new RegExp("^\\((" + urlRegexp + ")\\)"));
if (m && m[1]) {
consumed += m[0].length;
link = ["link", {href: m[1]}].concat(children);
return [consumed, link];
}
// [Alt text][id]
// [Alt text] [id]
m = text.match( /^\s*\[(.*?)\]/ );
if ( m ) {
consumed += m[ 0 ].length;