diff --git a/dist/showdown.js b/dist/showdown.js index ef48514..44b0334 100644 Binary files a/dist/showdown.js and b/dist/showdown.js differ diff --git a/dist/showdown.js.map b/dist/showdown.js.map index d50dbdd..8051f1d 100644 Binary files a/dist/showdown.js.map and b/dist/showdown.js.map differ diff --git a/dist/showdown.min.js b/dist/showdown.min.js index 1ce09ff..03e7446 100644 Binary files a/dist/showdown.min.js and b/dist/showdown.min.js differ diff --git a/dist/showdown.min.js.map b/dist/showdown.min.js.map index 278be22..0c433c8 100644 Binary files a/dist/showdown.min.js.map and b/dist/showdown.min.js.map differ diff --git a/src/converter.js b/src/converter.js index ba7fcfd..3fa6fcb 100644 --- a/src/converter.js +++ b/src/converter.js @@ -258,16 +258,15 @@ showdown.Converter = function (converterOptions) { ghCodeBlocks: [] }; - // attacklab: Replace ~ with ~T - // This lets us use tilde as an escape char to avoid md5 hashes + // This lets us use ¨ trema as an escape char to avoid md5 hashes // The choice of character is arbitrary; anything that isn't // magic in Markdown will work. - text = text.replace(/~/g, '~T'); + text = text.replace(/¨/g, '¨T'); - // attacklab: Replace $ with ~D + // Replace $ with ¨D // RegExp interprets $ as a special character // when it's in a replacement string - text = text.replace(/\$/g, '~D'); + text = text.replace(/\$/g, '¨D'); // Standardize line endings text = text.replace(/\r\n/g, '\n'); // DOS to Unix @@ -305,10 +304,10 @@ showdown.Converter = function (converterOptions) { text = showdown.subParser('unescapeSpecialChars')(text, options, globals); // attacklab: Restore dollar signs - text = text.replace(/~D/g, '$$'); + text = text.replace(/¨D/g, '$$'); - // attacklab: Restore tildes - text = text.replace(/~T/g, '~'); + // attacklab: Restore tremas + text = text.replace(/¨T/g, '¨'); // Run output modifiers showdown.helper.forEach(outputModifiers, function (ext) { diff --git a/src/helpers.js b/src/helpers.js index 9a4c4eb..ff008c6 100644 --- a/src/helpers.js +++ b/src/helpers.js @@ -104,7 +104,7 @@ showdown.helper.stdExtName = function (s) { function escapeCharactersCallback(wholeMatch, m1) { 'use strict'; var charCodeToEscape = m1.charCodeAt(0); - return '~E' + charCodeToEscape + 'E'; + return '¨E' + charCodeToEscape + 'E'; } /** diff --git a/src/subParsers/blockQuotes.js b/src/subParsers/blockQuotes.js index c1d8ffc..6bb30c1 100644 --- a/src/subParsers/blockQuotes.js +++ b/src/subParsers/blockQuotes.js @@ -8,10 +8,10 @@ showdown.subParser('blockQuotes', function (text, options, globals) { // attacklab: hack around Konqueror 3.5.4 bug: // "----------bug".replace(/^-/g,"") == "bug" - bq = bq.replace(/^[ \t]*>[ \t]?/gm, '~0'); // trim one level of quoting + bq = bq.replace(/^[ \t]*>[ \t]?/gm, '¨0'); // trim one level of quoting // attacklab: clean up hack - bq = bq.replace(/~0/g, ''); + bq = bq.replace(/¨0/g, ''); bq = bq.replace(/^[ \t]+$/gm, ''); // trim whitespace-only lines bq = showdown.subParser('githubCodeBlocks')(bq, options, globals); @@ -22,8 +22,8 @@ showdown.subParser('blockQuotes', function (text, options, globals) { bq = bq.replace(/(\s*
[^\r]+?<\/pre>)/gm, function (wholeMatch, m1) { var pre = m1; // attacklab: hack around Konqueror 3.5.4 bug: - pre = pre.replace(/^ /mg, '~0'); - pre = pre.replace(/~0/g, ''); + pre = pre.replace(/^ /mg, '¨0'); + pre = pre.replace(/¨0/g, ''); return pre; }); diff --git a/src/subParsers/codeBlocks.js b/src/subParsers/codeBlocks.js index ca6b606..8a13174 100644 --- a/src/subParsers/codeBlocks.js +++ b/src/subParsers/codeBlocks.js @@ -7,9 +7,9 @@ showdown.subParser('codeBlocks', function (text, options, globals) { text = globals.converter._dispatch('codeBlocks.before', text, options, globals); // sentinel workarounds for lack of \A and \Z, safari\khtml bug - text += '~0'; + text += '¨0'; - var pattern = /(?:\n\n|^)((?:(?:[ ]{4}|\t).*\n+)+)(\n*[ ]{0,3}[^ \t\n]|(?=~0))/g; + var pattern = /(?:\n\n|^)((?:(?:[ ]{4}|\t).*\n+)+)(\n*[ ]{0,3}[^ \t\n]|(?=¨0))/g; text = text.replace(pattern, function (wholeMatch, m1, m2) { var codeblock = m1, nextChar = m2, @@ -31,7 +31,7 @@ showdown.subParser('codeBlocks', function (text, options, globals) { }); // strip sentinel - text = text.replace(/~0/, ''); + text = text.replace(/¨0/, ''); text = globals.converter._dispatch('codeBlocks.after', text, options, globals); return text; diff --git a/src/subParsers/detab.js b/src/subParsers/detab.js index b3c6d65..77eed44 100644 --- a/src/subParsers/detab.js +++ b/src/subParsers/detab.js @@ -8,10 +8,10 @@ showdown.subParser('detab', function (text) { text = text.replace(/\t(?=\t)/g, ' '); // g_tab_width // replace the nth with two sentinels - text = text.replace(/\t/g, '~A~B'); + text = text.replace(/\t/g, '¨A¨B'); // use the sentinel to anchor our regex so it doesn't explode - text = text.replace(/~B(.+?)~A/g, function (wholeMatch, m1) { + text = text.replace(/¨B(.+?)¨A/g, function (wholeMatch, m1) { var leadingText = m1, numSpaces = 4 - leadingText.length % 4; // g_tab_width @@ -24,8 +24,8 @@ showdown.subParser('detab', function (text) { }); // clean up sentinels - text = text.replace(/~A/g, ' '); // g_tab_width - text = text.replace(/~B/g, ''); + text = text.replace(/¨A/g, ' '); // g_tab_width + text = text.replace(/¨B/g, ''); return text; diff --git a/src/subParsers/githubCodeBlocks.js b/src/subParsers/githubCodeBlocks.js index 877096c..0a88a4e 100644 --- a/src/subParsers/githubCodeBlocks.js +++ b/src/subParsers/githubCodeBlocks.js @@ -18,7 +18,7 @@ showdown.subParser('githubCodeBlocks', function (text, options, globals) { text = globals.converter._dispatch('githubCodeBlocks.before', text, options, globals); - text += '~0'; + text += '¨0'; text = text.replace(/(?:^|\n)```(.*)\n([\s\S]*?)\n```/g, function (wholeMatch, language, codeblock) { var end = (options.omitExtraWLInCodeBlocks) ? '' : '\n'; @@ -36,11 +36,11 @@ showdown.subParser('githubCodeBlocks', function (text, options, globals) { // Since GHCodeblocks can be false positives, we need to // store the primitive text and the parsed text in a global var, // and then return a token - return '\n\n~G' + (globals.ghCodeBlocks.push({text: wholeMatch, codeblock: codeblock}) - 1) + 'G\n\n'; + return '\n\n¨G' + (globals.ghCodeBlocks.push({text: wholeMatch, codeblock: codeblock}) - 1) + 'G\n\n'; }); // attacklab: strip sentinel - text = text.replace(/~0/, ''); + text = text.replace(/¨0/, ''); return globals.converter._dispatch('githubCodeBlocks.after', text, options, globals); }); diff --git a/src/subParsers/hashBlock.js b/src/subParsers/hashBlock.js index 3196f1d..145ac66 100644 --- a/src/subParsers/hashBlock.js +++ b/src/subParsers/hashBlock.js @@ -1,5 +1,5 @@ showdown.subParser('hashBlock', function (text, options, globals) { 'use strict'; text = text.replace(/(^\n+|\n+$)/g, ''); - return '\n\n~K' + (globals.gHtmlBlocks.push(text) - 1) + 'K\n\n'; + return '\n\n¨K' + (globals.gHtmlBlocks.push(text) - 1) + 'K\n\n'; }); diff --git a/src/subParsers/hashElement.js b/src/subParsers/hashElement.js index 7bf1291..80ad42d 100644 --- a/src/subParsers/hashElement.js +++ b/src/subParsers/hashElement.js @@ -11,8 +11,8 @@ showdown.subParser('hashElement', function (text, options, globals) { // strip trailing blank lines blockText = blockText.replace(/\n+$/g, ''); - // Replace the element text with a marker ("~KxK" where x is its key) - blockText = '\n\n~K' + (globals.gHtmlBlocks.push(blockText) - 1) + 'K\n\n'; + // Replace the element text with a marker ("¨KxK" where x is its key) + blockText = '\n\n¨K' + (globals.gHtmlBlocks.push(blockText) - 1) + 'K\n\n'; return blockText; }; diff --git a/src/subParsers/hashHTMLBlocks.js b/src/subParsers/hashHTMLBlocks.js index 442bb2e..fc674c5 100644 --- a/src/subParsers/hashHTMLBlocks.js +++ b/src/subParsers/hashHTMLBlocks.js @@ -44,7 +44,7 @@ showdown.subParser('hashHTMLBlocks', function (text, options, globals) { if (left.search(/\bmarkdown\b/) !== -1) { txt = left + globals.converter.makeHtml(match) + right; } - return '\n\n~K' + (globals.gHtmlBlocks.push(txt) - 1) + 'K\n\n'; + return '\n\n¨K' + (globals.gHtmlBlocks.push(txt) - 1) + 'K\n\n'; }; for (var i = 0; i < blockTags.length; ++i) { @@ -57,7 +57,7 @@ showdown.subParser('hashHTMLBlocks', function (text, options, globals) { // Special case for standalone HTML comments text = showdown.helper.replaceRecursiveRegExp(text, function (txt) { - return '\n\n~K' + (globals.gHtmlBlocks.push(txt) - 1) + 'K\n\n'; + return '\n\n¨K' + (globals.gHtmlBlocks.push(txt) - 1) + 'K\n\n'; }, '^ {0,3}', 'gm'); // PHP and ASP-style processor instructions (...?> and <%...%>) diff --git a/src/subParsers/hashHTMLSpans.js b/src/subParsers/hashHTMLSpans.js index 0d4fb02..9ac71bb 100644 --- a/src/subParsers/hashHTMLSpans.js +++ b/src/subParsers/hashHTMLSpans.js @@ -7,7 +7,7 @@ showdown.subParser('hashHTMLSpans', function (text, config, globals) { var matches = showdown.helper.matchRecursiveRegExp(text, ']*>', '
', 'gi'); for (var i = 0; i < matches.length; ++i) { - text = text.replace(matches[i][0], '~C' + (globals.gHtmlSpans.push(matches[i][0]) - 1) + 'C'); + text = text.replace(matches[i][0], '¨C' + (globals.gHtmlSpans.push(matches[i][0]) - 1) + 'C'); } return text; }); @@ -19,7 +19,7 @@ showdown.subParser('unhashHTMLSpans', function (text, config, globals) { 'use strict'; for (var i = 0; i < globals.gHtmlSpans.length; ++i) { - text = text.replace('~C' + i + 'C', globals.gHtmlSpans[i]); + text = text.replace('¨C' + i + 'C', globals.gHtmlSpans[i]); } return text; diff --git a/src/subParsers/hashPreCodeTags.js b/src/subParsers/hashPreCodeTags.js index 5d5cd2a..07b4d3a 100644 --- a/src/subParsers/hashPreCodeTags.js +++ b/src/subParsers/hashPreCodeTags.js @@ -7,7 +7,7 @@ showdown.subParser('hashPreCodeTags', function (text, config, globals) { var repFunc = function (wholeMatch, match, left, right) { // encode html entities var codeblock = left + showdown.subParser('encodeCode')(match) + right; - return '\n\n~G' + (globals.ghCodeBlocks.push({text: wholeMatch, codeblock: codeblock}) - 1) + 'G\n\n'; + return '\n\n¨G' + (globals.ghCodeBlocks.push({text: wholeMatch, codeblock: codeblock}) - 1) + 'G\n\n'; }; text = showdown.helper.replaceRecursiveRegExp(text, repFunc, '^ {0,3}]*>\\s*', 'gim'); diff --git a/src/subParsers/headers.js b/src/subParsers/headers.js index 332e139..72eadcd 100644 --- a/src/subParsers/headers.js +++ b/src/subParsers/headers.js @@ -58,13 +58,13 @@ showdown.subParser('headers', function (text, options, globals) { if (ghHeaderId) { escapedId = m .replace(/ /g, '-') - //replace previously escaped chars (&, ~ and $) + // replace previously escaped chars (&, ¨ and $) .replace(/&/g, '') - .replace(/~T/g, '') - .replace(/~D/g, '') - //replace rest of the chars (&~$ are repeated as they might have been escaped) + .replace(/¨T/g, '') + .replace(/¨D/g, '') + // replace rest of the chars (&~$ are repeated as they might have been escaped) // borrowed from github's redcarpet (some they should produce similar results) - .replace(/[&+$,\/:;=?@"#{}|^~\[\]`\\*)(%.!'<>]/g, '') + .replace(/[&+$,\/:;=?@"#{}|^¨~\[\]`\\*)(%.!'<>]/g, '') .toLowerCase(); } else { escapedId = m.replace(/[^\w]/g, '').toLowerCase(); diff --git a/src/subParsers/lists.js b/src/subParsers/lists.js index ee4f30b..baed74b 100644 --- a/src/subParsers/lists.js +++ b/src/subParsers/lists.js @@ -39,16 +39,16 @@ showdown.subParser('lists', function (text, options, globals) { listStr = listStr.replace(/\n{2,}$/, '\n'); // attacklab: add sentinel to emulate \z - listStr += '~0'; + listStr += '¨0'; - var rgx = /(\n)?(^ {0,3})([*+-]|\d+[.])[ \t]+((\[(x|X| )?])?[ \t]*[^\r]+?(\n{1,2}))(?=\n*(~0| {0,3}([*+-]|\d+[.])[ \t]+))/gm, - isParagraphed = (/\n[ \t]*\n(?!~0)/.test(listStr)); + var rgx = /(\n)?(^ {0,3})([*+-]|\d+[.])[ \t]+((\[(x|X| )?])?[ \t]*[^\r]+?(\n{1,2}))(?=\n*(¨0| {0,3}([*+-]|\d+[.])[ \t]+))/gm, + isParagraphed = (/\n[ \t]*\n(?!¨0)/.test(listStr)); // Since version 1.5, nesting sublists requires 4 spaces (or 1 tab) indentation, // which is a syntax breaking change // activating this option reverts to old behavior if (options.disableForced4SpacesIndentedSublists) { - rgx = /(\n)?(^ {0,3})([*+-]|\d+[.])[ \t]+((\[(x|X| )?])?[ \t]*[^\r]+?(\n{1,2}))(?=\n*(~0|\2([*+-]|\d+[.])[ \t]+))/gm; + rgx = /(\n)?(^ {0,3})([*+-]|\d+[.])[ \t]+((\[(x|X| )?])?[ \t]*[^\r]+?(\n{1,2}))(?=\n*(¨0|\2([*+-]|\d+[.])[ \t]+))/gm; } listStr = listStr.replace(rgx, function (wholeMatch, m1, m2, m3, m4, taskbtn, checked) { @@ -76,10 +76,10 @@ showdown.subParser('lists', function (text, options, globals) { //]*>', '^ {0,3}
\\s*
]*>\s*]*>/.test(grafsOutIt)) {
codeFlag = true;
diff --git a/src/subParsers/strikethrough.js b/src/subParsers/strikethrough.js
index 789c01f..e7c8757 100644
--- a/src/subParsers/strikethrough.js
+++ b/src/subParsers/strikethrough.js
@@ -3,7 +3,7 @@ showdown.subParser('strikethrough', function (text, options, globals) {
if (options.strikethrough) {
text = globals.converter._dispatch('strikethrough.before', text, options, globals);
- text = text.replace(/(?:~T){2}([\s\S]+?)(?:~T){2}/g, '$1');
+ text = text.replace(/(?:~){2}([\s\S]+?)(?:~){2}/g, '$1');
text = globals.converter._dispatch('strikethrough.after', text, options, globals);
}
diff --git a/src/subParsers/stripLinkDefinitions.js b/src/subParsers/stripLinkDefinitions.js
index 127cf69..a0da495 100644
--- a/src/subParsers/stripLinkDefinitions.js
+++ b/src/subParsers/stripLinkDefinitions.js
@@ -6,10 +6,10 @@
showdown.subParser('stripLinkDefinitions', function (text, options, globals) {
'use strict';
- var regex = /^ {0,3}\[(.+)]:[ \t]*\n?[ \t]*(\S+?)>?(?: =([*\d]+[A-Za-z%]{0,4})x([*\d]+[A-Za-z%]{0,4}))?[ \t]*\n?[ \t]*(?:(\n*)["|'(](.+?)["|')][ \t]*)?(?:\n+|(?=~0))/gm;
+ var regex = /^ {0,3}\[(.+)]:[ \t]*\n?[ \t]*(\S+?)>?(?: =([*\d]+[A-Za-z%]{0,4})x([*\d]+[A-Za-z%]{0,4}))?[ \t]*\n?[ \t]*(?:(\n*)["|'(](.+?)["|')][ \t]*)?(?:\n+|(?=¨0))/gm;
// attacklab: sentinel workarounds for lack of \A and \Z, safari\khtml bug
- text += '~0';
+ text += '¨0';
text = text.replace(regex, function (wholeMatch, linkId, url, width, height, blankLines, title) {
linkId = linkId.toLowerCase();
@@ -36,7 +36,7 @@ showdown.subParser('stripLinkDefinitions', function (text, options, globals) {
});
// attacklab: strip sentinel
- text = text.replace(/~0/, '');
+ text = text.replace(/¨0/, '');
return text;
});
diff --git a/src/subParsers/tables.js b/src/subParsers/tables.js
index b705d08..c57b926 100644
--- a/src/subParsers/tables.js
+++ b/src/subParsers/tables.js
@@ -5,7 +5,7 @@ showdown.subParser('tables', function (text, options, globals) {
return text;
}
- var tableRgx = /^ {0,3}\|?.+\|.+\n[ \t]{0,3}\|?[ \t]*:?[ \t]*(?:-|=){2,}[ \t]*:?[ \t]*\|[ \t]*:?[ \t]*(?:-|=){2,}[\s\S]+?(?:\n\n|~0)/gm;
+ var tableRgx = /^ {0,3}\|?.+\|.+\n[ \t]{0,3}\|?[ \t]*:?[ \t]*(?:-|=){2,}[ \t]*:?[ \t]*\|[ \t]*:?[ \t]*(?:-|=){2,}[\s\S]+?(?:\n\n|¨0)/gm;
function parseStyles(sLine) {
if (/^:[ \t]*--*$/.test(sLine)) {
diff --git a/src/subParsers/unescapeSpecialChars.js b/src/subParsers/unescapeSpecialChars.js
index 1873f43..dbb1618 100644
--- a/src/subParsers/unescapeSpecialChars.js
+++ b/src/subParsers/unescapeSpecialChars.js
@@ -4,7 +4,7 @@
showdown.subParser('unescapeSpecialChars', function (text) {
'use strict';
- text = text.replace(/~E(\d+)E/g, function (wholeMatch, m1) {
+ text = text.replace(/¨E(\d+)E/g, function (wholeMatch, m1) {
var charCodeToReplace = parseInt(m1);
return String.fromCharCode(charCodeToReplace);
});