Skip to content

Commit

Permalink
Merge remote-tracking branch 'abackstrom/striplinkdefinitions-endstring'
Browse files Browse the repository at this point in the history
  • Loading branch information
Corey Innis committed Oct 31, 2012
2 parents e517605 + 6645ca1 commit 8a88206
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/showdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,11 @@ var _StripLinkDefinitions = function(text) {
/gm,
function(){...});
*/
var text = text.replace(/^[ ]{0,3}\[(.+)\]:[ \t]*\n?[ \t]*<?(\S+?)>?[ \t]*\n?[ \t]*(?:(\n*)["(](.+?)[")][ \t]*)?(?:\n+|\Z)/gm,

// attacklab: sentinel workarounds for lack of \A and \Z, safari\khtml bug
text += "~0";

var text = text.replace(/^[ ]{0,3}\[(.+)\]:[ \t]*\n?[ \t]*<?(\S+?)>?[ \t]*\n?[ \t]*(?:(\n*)["(](.+?)[")][ \t]*)?(?:\n+|(?=~0))/gm,
function (wholeMatch,m1,m2,m3,m4) {
m1 = m1.toLowerCase();
g_urls[m1] = _EncodeAmpsAndAngles(m2); // Link IDs are case-insensitive
Expand All @@ -303,6 +307,9 @@ var _StripLinkDefinitions = function(text) {
}
);

// attacklab: strip sentinel
text = text.replace(/~0/,"");

return text;
}

Expand Down

0 comments on commit 8a88206

Please sign in to comment.