mirror of
https://github.com/discourse/discourse.git
synced 2025-01-19 07:42:45 +08:00
FIX: Updated Markdown-js to include my latest FIX from upstream:
https://github.com/evilstreak/markdown-js/pull/164
This commit is contained in:
parent
2684f20ada
commit
0a8432645d
13
vendor/assets/javascripts/better_markdown.js
vendored
13
vendor/assets/javascripts/better_markdown.js
vendored
|
@ -681,6 +681,9 @@
|
||||||
isEmpty = MarkdownHelpers.isEmpty,
|
isEmpty = MarkdownHelpers.isEmpty,
|
||||||
inline_until_char = DialectHelpers.inline_until_char;
|
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
|
* Gruber dialect
|
||||||
*
|
*
|
||||||
|
@ -1222,7 +1225,7 @@
|
||||||
//
|
//
|
||||||
// First attempt to use a strong URL regexp to catch things like parentheses. If it misses, use the
|
// First attempt to use a strong URL regexp to catch things like parentheses. If it misses, use the
|
||||||
// old one.
|
// 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]*\)/ );
|
text.match( /^!\[(.*?)\][ \t]*\([ \t]*([^")]*?)(?:[ \t]+(["'])(.*?)\3)?[ \t]*\)/ );
|
||||||
|
|
||||||
if ( m ) {
|
if ( m ) {
|
||||||
|
@ -1324,10 +1327,16 @@
|
||||||
return [ consumed, link ];
|
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]
|
||||||
// [Alt text] [id]
|
// [Alt text] [id]
|
||||||
m = text.match( /^\s*\[(.*?)\]/ );
|
m = text.match( /^\s*\[(.*?)\]/ );
|
||||||
|
|
||||||
if ( m ) {
|
if ( m ) {
|
||||||
|
|
||||||
consumed += m[ 0 ].length;
|
consumed += m[ 0 ].length;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user