diff --git a/dist/showdown.js b/dist/showdown.js
index 2e0f6bf..675c45f 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 ec138f8..4cd9ef3 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 f247d69..16c3cb5 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 d2d2444..5806330 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 8aa9d61..58e4e77 100644
--- a/src/converter.js
+++ b/src/converter.js
@@ -197,7 +197,7 @@ showdown.Converter = function (converterOptions) {
if (typeof callback !== 'function') {
throw Error('Invalid argument in converter.listen() method: callback must be a function, but ' + typeof callback + ' given');
}
-
+ name = name.toLowerCase();
if (!listeners.hasOwnProperty(name)) {
listeners[name] = [];
}
@@ -211,24 +211,33 @@ showdown.Converter = function (converterOptions) {
}
/**
- * Dispatch an event
- * @private
+ *
* @param {string} evtName Event name
* @param {string} text Text
* @param {{}} options Converter Options
- * @param {{}} globals
- * @returns {string}
+ * @param {{}} globals Converter globals
+ * @param {{}} pParams extra params for event
+ * @returns showdown.helper.Event
+ * @private
*/
- this._dispatch = function dispatch (evtName, text, options, globals) {
+ this._dispatch = function dispatch (evtName, text, options, globals, pParams) {
+ evtName = evtName.toLowerCase();
+ var params = pParams || {};
+ params.converter = this;
+ params.text = text;
+ params.options = options;
+ params.globals = globals;
+ var event = new showdown.helper.Event(evtName, text, params);
+
if (listeners.hasOwnProperty(evtName)) {
for (var ei = 0; ei < listeners[evtName].length; ++ei) {
- var nText = listeners[evtName][ei](evtName, text, this, options, globals);
+ var nText = listeners[evtName][ei](event);
if (nText && typeof nText !== 'undefined') {
- text = nText;
+ event.setText(nText);
}
}
}
- return text;
+ return event;
};
/**
diff --git a/src/helpers.js b/src/helpers.js
index 6159c23..820b874 100644
--- a/src/helpers.js
+++ b/src/helpers.js
@@ -396,6 +396,69 @@ showdown.helper.unescapeHTMLEntities = function (txt) {
.replace(/&/g, '&');
};
+/**
+ * Showdown's Event Object
+ * @param {string} name Name of the event
+ * @param {{}} params optional. params of the event
+ * @constructor
+ */
+showdown.helper.Event = function (name, text, params) {
+ 'use strict';
+
+ /**
+ * Get the name of the event
+ * @returns {string}
+ */
+ this.getName = function () {
+ return name;
+ };
+
+ this.getEventName = function () {
+ return name;
+ };
+
+ var regexp = params.regexp || null;
+ var matches = params.matches || {};
+ var options = params.options || {};
+ var converter = params.converter || null;
+ var globals = params.globals || {};
+
+ this._stopExecution = false;
+
+ this.parsedText = params.parsedText || null;
+
+ this.getRegexp = function () {
+ return regexp;
+ };
+ this.getOptions = function () {
+ return options;
+ };
+ this.getConverter = function () {
+ return converter;
+ };
+ this.getGlobals = function () {
+ return globals;
+ };
+ this.getCapturedText = function () {
+ return text;
+ };
+ this.getText = function () {
+ return text;
+ };
+ this.setText = function (newText) {
+ text = newText;
+ };
+ this.getMatches = function () {
+ return matches;
+ };
+ this.setMatches = function (newMatches) {
+ matches = newMatches;
+ };
+ this.preventDefault = function (bool) {
+ this._stopExecution = !bool;
+ };
+};
+
/**
* POLYFILLS
*/
@@ -1604,6 +1667,6 @@ showdown.helper.emojis = {
'zzz':'\ud83d\udca4',
/* special emojis :P */
- 'octocat': '',
+ 'octocat': '
',
'showdown': '
'
};
diff --git a/src/subParsers/makehtml/anchors.js b/src/subParsers/makehtml/anchors.js
index 1adc213..e96f57d 100644
--- a/src/subParsers/makehtml/anchors.js
+++ b/src/subParsers/makehtml/anchors.js
@@ -4,74 +4,96 @@
showdown.subParser('makehtml.anchors', function (text, options, globals) {
'use strict';
- text = globals.converter._dispatch('makehtml.anchors.before', text, options, globals);
+ text = globals.converter._dispatch('makehtml.anchors.before', text, options, globals).getText();
- var writeAnchorTag = function (wholeMatch, linkText, linkId, url, m5, m6, title) {
- if (showdown.helper.isUndefined(title)) {
- title = '';
- }
- linkId = linkId.toLowerCase();
+ var writeAnchorTag = function (rgx) {
- // Special case for explicit empty url
- if (wholeMatch.search(/\(\s*>? ?(['"].*['"])?\)$/m) > -1) {
- url = '';
- } else if (!url) {
- if (!linkId) {
- // lower-case and turn embedded newlines into spaces
- linkId = linkText.toLowerCase().replace(/ ?\n/g, ' ');
- }
- url = '#' + linkId;
-
- if (!showdown.helper.isUndefined(globals.gUrls[linkId])) {
- url = globals.gUrls[linkId];
- if (!showdown.helper.isUndefined(globals.gTitles[linkId])) {
- title = globals.gTitles[linkId];
+ return function (wholeMatch1, linkText1, linkId1, url1, m5, m6, title1) {
+ var evt = globals.converter._dispatch('makehtml.anchors.capture_begin', wholeMatch1, options, globals, {
+ regexp: rgx,
+ matches: {
+ wholeMatch: wholeMatch1,
+ linkText: linkText1,
+ linkId: linkId1,
+ url: url1,
+ title: title1
}
- } else {
- return wholeMatch;
+ });
+
+ var wholeMatch = evt.getMatches().wholeMatch;
+ var linkText = evt.getMatches().linkText;
+ var linkId = evt.getMatches().linkId;
+ var url = evt.getMatches().url;
+ var title = evt.getMatches().title;
+
+ if (showdown.helper.isUndefined(title)) {
+ title = '';
}
- }
+ linkId = linkId.toLowerCase();
- //url = showdown.helper.escapeCharacters(url, '*_', false); // replaced line to improve performance
- url = url.replace(showdown.helper.regexes.asteriskDashAndColon, showdown.helper.escapeCharactersCallback);
+ // Special case for explicit empty url
+ if (wholeMatch.search(/\(\s*>? ?(['"].*['"])?\)$/m) > -1) {
+ url = '';
+ } else if (!url) {
+ if (!linkId) {
+ // lower-case and turn embedded newlines into spaces
+ linkId = linkText.toLowerCase().replace(/ ?\n/g, ' ');
+ }
+ url = '#' + linkId;
- var result = '' + linkText + '';
+ if (title !== '' && title !== null) {
+ title = title.replace(/"/g, '"');
+ //title = showdown.helper.escapeCharacters(title, '*_', false); // replaced line to improve performance
+ title = title.replace(showdown.helper.regexes.asteriskDashAndColon, showdown.helper.escapeCharactersCallback);
+ result += ' title="' + title + '"';
+ }
- return result;
+ // optionLinksInNewWindow only applies
+ // to external links. Hash links (#) open in same page
+ if (options.openLinksInNewWindow && !/^#/.test(url)) {
+ // escaped _
+ result += ' target="¨E95Eblank"';
+ }
+
+ result += '>' + linkText + '';
+
+ return result;
+ };
};
+ var referenceRegex = /\[((?:\[[^\]]*]|[^\[\]])*)] ?(?:\n *)?\[(.*?)]()()()()/g;
// First, handle reference-style links: [link text] [id]
- text = text.replace(/\[((?:\[[^\]]*]|[^\[\]])*)] ?(?:\n *)?\[(.*?)]()()()()/g, writeAnchorTag);
+ text = text.replace(referenceRegex, writeAnchorTag(referenceRegex));
// Next, inline-style links: [link text](url "optional title")
// cases with crazy urls like ./image/cat1).png
- text = text.replace(/\[((?:\[[^\]]*]|[^\[\]])*)]()[ \t]*\([ \t]?<([^>]*)>(?:[ \t]*((["'])([^"]*?)\5))?[ \t]?\)/g,
- writeAnchorTag);
+ var inlineRegexCrazy = /\[((?:\[[^\]]*]|[^\[\]])*)]()[ \t]*\([ \t]?<([^>]*)>(?:[ \t]*((["'])([^"]*?)\5))?[ \t]?\)/g;
+ text = text.replace(inlineRegexCrazy, writeAnchorTag(inlineRegexCrazy));
// normal cases
- text = text.replace(/\[((?:\[[^\]]*]|[^\[\]])*)]()[ \t]*\([ \t]?([\S]+?(?:\([\S]*?\)[\S]*?)?)>?(?:[ \t]*((["'])([^"]*?)\5))?[ \t]?\)/g,
- writeAnchorTag);
+ var inlineRegex = /\[((?:\[[^\]]*]|[^\[\]])*)]()[ \t]*\([ \t]?([\S]+?(?:\([\S]*?\)[\S]*?)?)>?(?:[ \t]*((["'])([^"]*?)\5))?[ \t]?\)/g;
+ text = text.replace(inlineRegex, writeAnchorTag(inlineRegex));
// handle reference-style shortcuts: [link text]
// These must come last in case you've also got [link test][1]
// or [link test](/foo)
- text = text.replace(/\[([^\[\]]+)]()()()()()/g, writeAnchorTag);
+ var referenceShortcutRegex = /\[([^\[\]]+)]()()()()()/g;
+ text = text.replace(referenceShortcutRegex, writeAnchorTag(referenceShortcutRegex));
// Lastly handle GithubMentions if option is enabled
if (options.ghMentions) {
@@ -93,6 +115,6 @@ showdown.subParser('makehtml.anchors', function (text, options, globals) {
});
}
- text = globals.converter._dispatch('makehtml.anchors.after', text, options, globals);
+ text = globals.converter._dispatch('makehtml.anchors.after', text, options, globals).getText();
return text;
});
diff --git a/src/subParsers/makehtml/autoLinks.js b/src/subParsers/makehtml/autoLinks.js
index 0896d7a..ca39193 100644
--- a/src/subParsers/makehtml/autoLinks.js
+++ b/src/subParsers/makehtml/autoLinks.js
@@ -47,12 +47,12 @@ var simpleURLRegex = /([*~_]+|\b)(((https?|ftp|dict):\/\/|www\.)[^'">\s]+?\.[^'
showdown.subParser('makehtml.autoLinks', function (text, options, globals) {
'use strict';
- text = globals.converter._dispatch('makehtml.autoLinks.before', text, options, globals);
+ text = globals.converter._dispatch('makehtml.autoLinks.before', text, options, globals).getText();
text = text.replace(delimUrlRegex, replaceLink(options));
text = text.replace(delimMailRegex, replaceMail(options, globals));
- text = globals.converter._dispatch('makehtml.autoLinks.after', text, options, globals);
+ text = globals.converter._dispatch('makehtml.autoLinks.after', text, options, globals).getText();
return text;
});
@@ -64,7 +64,7 @@ showdown.subParser('makehtml.simplifiedAutoLinks', function (text, options, glob
return text;
}
- text = globals.converter._dispatch('makehtml.simplifiedAutoLinks.before', text, options, globals);
+ text = globals.converter._dispatch('makehtml.simplifiedAutoLinks.before', text, options, globals).getText();
if (options.excludeTrailingPunctuationFromURLs) {
text = text.replace(simpleURLRegex2, replaceLink(options));
@@ -73,7 +73,7 @@ showdown.subParser('makehtml.simplifiedAutoLinks', function (text, options, glob
}
text = text.replace(simpleMailRegex, replaceMail(options, globals));
- text = globals.converter._dispatch('makehtml.simplifiedAutoLinks.after', text, options, globals);
+ text = globals.converter._dispatch('makehtml.simplifiedAutoLinks.after', text, options, globals).getText();
return text;
});
diff --git a/src/subParsers/makehtml/blockGamut.js b/src/subParsers/makehtml/blockGamut.js
index 2f46771..7a9b2b6 100644
--- a/src/subParsers/makehtml/blockGamut.js
+++ b/src/subParsers/makehtml/blockGamut.js
@@ -5,7 +5,7 @@
showdown.subParser('makehtml.blockGamut', function (text, options, globals) {
'use strict';
- text = globals.converter._dispatch('makehtml.blockGamut.before', text, options, globals);
+ text = globals.converter._dispatch('makehtml.blockGamut.before', text, options, globals).getText();
// we parse blockquotes first so that we can have headings and hrs
// inside blockquotes
@@ -26,7 +26,7 @@ showdown.subParser('makehtml.blockGamut', function (text, options, globals) {
text = showdown.subParser('makehtml.hashHTMLBlocks')(text, options, globals);
text = showdown.subParser('makehtml.paragraphs')(text, options, globals);
- text = globals.converter._dispatch('makehtml.blockGamut.after', text, options, globals);
+ text = globals.converter._dispatch('makehtml.blockGamut.after', text, options, globals).getText();
return text;
});
diff --git a/src/subParsers/makehtml/blockQuotes.js b/src/subParsers/makehtml/blockQuotes.js
index b372401..256f3d7 100644
--- a/src/subParsers/makehtml/blockQuotes.js
+++ b/src/subParsers/makehtml/blockQuotes.js
@@ -1,7 +1,7 @@
showdown.subParser('makehtml.blockQuotes', function (text, options, globals) {
'use strict';
- text = globals.converter._dispatch('makehtml.blockQuotes.before', text, options, globals);
+ text = globals.converter._dispatch('makehtml.blockQuotes.before', text, options, globals).getText();
// add a couple extra lines after the text and endtext mark
text = text + '\n\n';
@@ -37,6 +37,6 @@ showdown.subParser('makehtml.blockQuotes', function (text, options, globals) {
return showdown.subParser('makehtml.hashBlock')('
\n' + bq + '\n', options, globals); }); - text = globals.converter._dispatch('makehtml.blockQuotes.after', text, options, globals); + text = globals.converter._dispatch('makehtml.blockQuotes.after', text, options, globals).getText(); return text; }); diff --git a/src/subParsers/makehtml/codeBlocks.js b/src/subParsers/makehtml/codeBlocks.js index 271d092..ed9da66 100644 --- a/src/subParsers/makehtml/codeBlocks.js +++ b/src/subParsers/makehtml/codeBlocks.js @@ -4,7 +4,7 @@ showdown.subParser('makehtml.codeBlocks', function (text, options, globals) { 'use strict'; - text = globals.converter._dispatch('makehtml.codeBlocks.before', text, options, globals); + text = globals.converter._dispatch('makehtml.codeBlocks.before', text, options, globals).getText(); // sentinel workarounds for lack of \A and \Z, safari\khtml bug text += '¨0'; @@ -33,6 +33,6 @@ showdown.subParser('makehtml.codeBlocks', function (text, options, globals) { // strip sentinel text = text.replace(/¨0/, ''); - text = globals.converter._dispatch('makehtml.codeBlocks.after', text, options, globals); + text = globals.converter._dispatch('makehtml.codeBlocks.after', text, options, globals).getText(); return text; }); diff --git a/src/subParsers/makehtml/codeSpans.js b/src/subParsers/makehtml/codeSpans.js index 54f2e94..8da5f84 100644 --- a/src/subParsers/makehtml/codeSpans.js +++ b/src/subParsers/makehtml/codeSpans.js @@ -26,7 +26,7 @@ showdown.subParser('makehtml.codeSpans', function (text, options, globals) { 'use strict'; - text = globals.converter._dispatch('makehtml.codeSpans.before', text, options, globals); + text = globals.converter._dispatch('makehtml.codeSpans.before', text, options, globals).getText(); if (typeof(text) === 'undefined') { text = ''; @@ -43,6 +43,6 @@ showdown.subParser('makehtml.codeSpans', function (text, options, globals) { } ); - text = globals.converter._dispatch('makehtml.codeSpans.after', text, options, globals); + text = globals.converter._dispatch('makehtml.codeSpans.after', text, options, globals).getText(); return text; }); diff --git a/src/subParsers/makehtml/completeHTMLDocument.js b/src/subParsers/makehtml/completeHTMLDocument.js index 464e94a..79cb3e7 100644 --- a/src/subParsers/makehtml/completeHTMLDocument.js +++ b/src/subParsers/makehtml/completeHTMLDocument.js @@ -8,7 +8,7 @@ showdown.subParser('makehtml.completeHTMLDocument', function (text, options, glo return text; } - text = globals.converter._dispatch('makehtml.completeHTMLDocument.before', text, options, globals); + text = globals.converter._dispatch('makehtml.completeHTMLDocument.before', text, options, globals).getText(); var doctype = 'html', doctypeParsed = '\n', @@ -57,6 +57,6 @@ showdown.subParser('makehtml.completeHTMLDocument', function (text, options, glo text = doctypeParsed + '\n\n' + title + charset + metadata + '\n\n' + text.trim() + '\n\n'; - text = globals.converter._dispatch('makehtml.completeHTMLDocument.after', text, options, globals); + text = globals.converter._dispatch('makehtml.completeHTMLDocument.after', text, options, globals).getText(); return text; }); diff --git a/src/subParsers/makehtml/detab.js b/src/subParsers/makehtml/detab.js index 44dc86c..41e1180 100644 --- a/src/subParsers/makehtml/detab.js +++ b/src/subParsers/makehtml/detab.js @@ -3,7 +3,7 @@ */ showdown.subParser('makehtml.detab', function (text, options, globals) { 'use strict'; - text = globals.converter._dispatch('makehtml.detab.before', text, options, globals); + text = globals.converter._dispatch('makehtml.detab.before', text, options, globals).getText(); // expand first n-1 tabs text = text.replace(/\t(?=\t)/g, ' '); // g_tab_width @@ -28,6 +28,6 @@ showdown.subParser('makehtml.detab', function (text, options, globals) { text = text.replace(/¨A/g, ' '); // g_tab_width text = text.replace(/¨B/g, ''); - text = globals.converter._dispatch('makehtml.detab.after', text, options, globals); + text = globals.converter._dispatch('makehtml.detab.after', text, options, globals).getText(); return text; }); diff --git a/src/subParsers/makehtml/ellipsis.js b/src/subParsers/makehtml/ellipsis.js index 39d1292..68856a6 100644 --- a/src/subParsers/makehtml/ellipsis.js +++ b/src/subParsers/makehtml/ellipsis.js @@ -1,11 +1,11 @@ showdown.subParser('makehtml.ellipsis', function (text, options, globals) { 'use strict'; - text = globals.converter._dispatch('makehtml.ellipsis.before', text, options, globals); + text = globals.converter._dispatch('makehtml.ellipsis.before', text, options, globals).getText(); text = text.replace(/\.\.\./g, '…'); - text = globals.converter._dispatch('makehtml.ellipsis.after', text, options, globals); + text = globals.converter._dispatch('makehtml.ellipsis.after', text, options, globals).getText(); return text; }); diff --git a/src/subParsers/makehtml/emoji.js b/src/subParsers/makehtml/emoji.js index 5746509..0a2523f 100644 --- a/src/subParsers/makehtml/emoji.js +++ b/src/subParsers/makehtml/emoji.js @@ -9,7 +9,7 @@ showdown.subParser('makehtml.emoji', function (text, options, globals) { return text; } - text = globals.converter._dispatch('makehtml.emoji.before', text, options, globals); + text = globals.converter._dispatch('makehtml.emoji.before', text, options, globals).getText(); var emojiRgx = /:([\S]+?):/g; @@ -20,7 +20,7 @@ showdown.subParser('makehtml.emoji', function (text, options, globals) { return wm; }); - text = globals.converter._dispatch('makehtml.emoji.after', text, options, globals); + text = globals.converter._dispatch('makehtml.emoji.after', text, options, globals).getText(); return text; }); diff --git a/src/subParsers/makehtml/encodeAmpsAndAngles.js b/src/subParsers/makehtml/encodeAmpsAndAngles.js index 086d236..e69322d 100644 --- a/src/subParsers/makehtml/encodeAmpsAndAngles.js +++ b/src/subParsers/makehtml/encodeAmpsAndAngles.js @@ -3,7 +3,7 @@ */ showdown.subParser('makehtml.encodeAmpsAndAngles', function (text, options, globals) { 'use strict'; - text = globals.converter._dispatch('makehtml.encodeAmpsAndAngles.before', text, options, globals); + text = globals.converter._dispatch('makehtml.encodeAmpsAndAngles.before', text, options, globals).getText(); // Ampersand-encoding based entirely on Nat Irons's Amputator MT plugin: // http://bumppo.net/projects/amputator/ @@ -18,6 +18,6 @@ showdown.subParser('makehtml.encodeAmpsAndAngles', function (text, options, glob // Encode > text = text.replace(/>/g, '>'); - text = globals.converter._dispatch('makehtml.encodeAmpsAndAngles.after', text, options, globals); + text = globals.converter._dispatch('makehtml.encodeAmpsAndAngles.after', text, options, globals).getText(); return text; }); diff --git a/src/subParsers/makehtml/encodeBackslashEscapes.js b/src/subParsers/makehtml/encodeBackslashEscapes.js index 3a7bc23..4a888e2 100644 --- a/src/subParsers/makehtml/encodeBackslashEscapes.js +++ b/src/subParsers/makehtml/encodeBackslashEscapes.js @@ -11,11 +11,11 @@ */ showdown.subParser('makehtml.encodeBackslashEscapes', function (text, options, globals) { 'use strict'; - text = globals.converter._dispatch('makehtml.encodeBackslashEscapes.before', text, options, globals); + text = globals.converter._dispatch('makehtml.encodeBackslashEscapes.before', text, options, globals).getText(); text = text.replace(/\\(\\)/g, showdown.helper.escapeCharactersCallback); text = text.replace(/\\([`*_{}\[\]()>#+.!~=|-])/g, showdown.helper.escapeCharactersCallback); - text = globals.converter._dispatch('makehtml.encodeBackslashEscapes.after', text, options, globals); + text = globals.converter._dispatch('makehtml.encodeBackslashEscapes.after', text, options, globals).getText(); return text; }); diff --git a/src/subParsers/makehtml/encodeCode.js b/src/subParsers/makehtml/encodeCode.js index 23899e2..84afaf7 100644 --- a/src/subParsers/makehtml/encodeCode.js +++ b/src/subParsers/makehtml/encodeCode.js @@ -6,7 +6,7 @@ showdown.subParser('makehtml.encodeCode', function (text, options, globals) { 'use strict'; - text = globals.converter._dispatch('makehtml.encodeCode.before', text, options, globals); + text = globals.converter._dispatch('makehtml.encodeCode.before', text, options, globals).getText(); // Encode all ampersands; HTML entities are not // entities within a Markdown code span. @@ -18,6 +18,6 @@ showdown.subParser('makehtml.encodeCode', function (text, options, globals) { // Now, escape characters that are magic in Markdown: .replace(/([*_{}\[\]\\=~-])/g, showdown.helper.escapeCharactersCallback); - text = globals.converter._dispatch('makehtml.encodeCode.after', text, options, globals); + text = globals.converter._dispatch('makehtml.encodeCode.after', text, options, globals).getText(); return text; }); diff --git a/src/subParsers/makehtml/escapeSpecialCharsWithinTagAttributes.js b/src/subParsers/makehtml/escapeSpecialCharsWithinTagAttributes.js index 610fbe7..6819588 100644 --- a/src/subParsers/makehtml/escapeSpecialCharsWithinTagAttributes.js +++ b/src/subParsers/makehtml/escapeSpecialCharsWithinTagAttributes.js @@ -4,7 +4,7 @@ */ showdown.subParser('makehtml.escapeSpecialCharsWithinTagAttributes', function (text, options, globals) { 'use strict'; - text = globals.converter._dispatch('makehtml.escapeSpecialCharsWithinTagAttributes.before', text, options, globals); + text = globals.converter._dispatch('makehtml.escapeSpecialCharsWithinTagAttributes.before', text, options, globals).getText(); // Build a regex to find HTML tags. var tags = /<\/?[a-z\d_:-]+(?:[\s]+[\s\S]+?)?>/gi, @@ -21,6 +21,6 @@ showdown.subParser('makehtml.escapeSpecialCharsWithinTagAttributes', function (t .replace(/([\\`*_~=|])/g, showdown.helper.escapeCharactersCallback); }); - text = globals.converter._dispatch('makehtml.escapeSpecialCharsWithinTagAttributes.after', text, options, globals); + text = globals.converter._dispatch('makehtml.escapeSpecialCharsWithinTagAttributes.after', text, options, globals).getText(); return text; }); diff --git a/src/subParsers/makehtml/githubCodeBlocks.js b/src/subParsers/makehtml/githubCodeBlocks.js index 75617ba..660ba75 100644 --- a/src/subParsers/makehtml/githubCodeBlocks.js +++ b/src/subParsers/makehtml/githubCodeBlocks.js @@ -16,7 +16,7 @@ showdown.subParser('makehtml.githubCodeBlocks', function (text, options, globals return text; } - text = globals.converter._dispatch('makehtml.githubCodeBlocks.before', text, options, globals); + text = globals.converter._dispatch('makehtml.githubCodeBlocks.before', text, options, globals).getText(); text += '¨0'; @@ -42,5 +42,5 @@ showdown.subParser('makehtml.githubCodeBlocks', function (text, options, globals // attacklab: strip sentinel text = text.replace(/¨0/, ''); - return globals.converter._dispatch('makehtml.githubCodeBlocks.after', text, options, globals); + return globals.converter._dispatch('makehtml.githubCodeBlocks.after', text, options, globals).getText(); }); diff --git a/src/subParsers/makehtml/hashBlock.js b/src/subParsers/makehtml/hashBlock.js index c998d82..c14948f 100644 --- a/src/subParsers/makehtml/hashBlock.js +++ b/src/subParsers/makehtml/hashBlock.js @@ -1,8 +1,8 @@ showdown.subParser('makehtml.hashBlock', function (text, options, globals) { 'use strict'; - text = globals.converter._dispatch('makehtml.hashBlock.before', text, options, globals); + text = globals.converter._dispatch('makehtml.hashBlock.before', text, options, globals).getText(); text = text.replace(/(^\n+|\n+$)/g, ''); text = '\n\n¨K' + (globals.gHtmlBlocks.push(text) - 1) + 'K\n\n'; - text = globals.converter._dispatch('makehtml.hashBlock.after', text, options, globals); + text = globals.converter._dispatch('makehtml.hashBlock.after', text, options, globals).getText(); return text; }); diff --git a/src/subParsers/makehtml/hashCodeTags.js b/src/subParsers/makehtml/hashCodeTags.js index 36c18e4..6a77042 100644 --- a/src/subParsers/makehtml/hashCodeTags.js +++ b/src/subParsers/makehtml/hashCodeTags.js @@ -3,7 +3,7 @@ */ showdown.subParser('makehtml.hashCodeTags', function (text, options, globals) { 'use strict'; - text = globals.converter._dispatch('makehtml.hashCodeTags.before', text, options, globals); + text = globals.converter._dispatch('makehtml.hashCodeTags.before', text, options, globals).getText(); var repFunc = function (wholeMatch, match, left, right) { var codeblock = left + showdown.subParser('makehtml.encodeCode')(match, options, globals) + right; @@ -13,6 +13,6 @@ showdown.subParser('makehtml.hashCodeTags', function (text, options, globals) { // Hash naked
text = showdown.helper.replaceRecursiveRegExp(text, repFunc, ']*>', '
', 'gim');
- text = globals.converter._dispatch('makehtml.hashCodeTags.after', text, options, globals);
+ text = globals.converter._dispatch('makehtml.hashCodeTags.after', text, options, globals).getText();
return text;
});
diff --git a/src/subParsers/makehtml/hashHTMLBlocks.js b/src/subParsers/makehtml/hashHTMLBlocks.js
index fadd57a..0d18d86 100644
--- a/src/subParsers/makehtml/hashHTMLBlocks.js
+++ b/src/subParsers/makehtml/hashHTMLBlocks.js
@@ -1,6 +1,6 @@
showdown.subParser('makehtml.hashHTMLBlocks', function (text, options, globals) {
'use strict';
- text = globals.converter._dispatch('makehtml.hashHTMLBlocks.before', text, options, globals);
+ text = globals.converter._dispatch('makehtml.hashHTMLBlocks.before', text, options, globals).getText();
var blockTags = [
'pre',
@@ -93,6 +93,6 @@ showdown.subParser('makehtml.hashHTMLBlocks', function (text, options, globals)
text = text.replace(/(?:\n\n)( {0,3}(?:<([?%])[^\r]*?\2>)[ \t]*(?=\n{2,}))/g,
showdown.subParser('makehtml.hashElement')(text, options, globals));
- text = globals.converter._dispatch('makehtml.hashHTMLBlocks.after', text, options, globals);
+ text = globals.converter._dispatch('makehtml.hashHTMLBlocks.after', text, options, globals).getText();
return text;
});
diff --git a/src/subParsers/makehtml/hashHTMLSpans.js b/src/subParsers/makehtml/hashHTMLSpans.js
index 0745d7c..0adb324 100644
--- a/src/subParsers/makehtml/hashHTMLSpans.js
+++ b/src/subParsers/makehtml/hashHTMLSpans.js
@@ -3,7 +3,7 @@
*/
showdown.subParser('makehtml.hashHTMLSpans', function (text, options, globals) {
'use strict';
- text = globals.converter._dispatch('makehtml.hashHTMLSpans.before', text, options, globals);
+ text = globals.converter._dispatch('makehtml.hashHTMLSpans.before', text, options, globals).getText();
function hashHTMLSpan (html) {
return '¨C' + (globals.gHtmlSpans.push(html) - 1) + 'C';
@@ -31,7 +31,7 @@ showdown.subParser('makehtml.hashHTMLSpans', function (text, options, globals) {
/*showdown.helper.matchRecursiveRegExp(text, ']*>', '
', 'gi');*/
- text = globals.converter._dispatch('makehtml.hashHTMLSpans.after', text, options, globals);
+ text = globals.converter._dispatch('makehtml.hashHTMLSpans.after', text, options, globals).getText();
return text;
});
@@ -40,7 +40,7 @@ showdown.subParser('makehtml.hashHTMLSpans', function (text, options, globals) {
*/
showdown.subParser('makehtml.unhashHTMLSpans', function (text, options, globals) {
'use strict';
- text = globals.converter._dispatch('makehtml.unhashHTMLSpans.before', text, options, globals);
+ text = globals.converter._dispatch('makehtml.unhashHTMLSpans.before', text, options, globals).getText();
for (var i = 0; i < globals.gHtmlSpans.length; ++i) {
var repText = globals.gHtmlSpans[i],
@@ -59,6 +59,6 @@ showdown.subParser('makehtml.unhashHTMLSpans', function (text, options, globals)
text = text.replace('¨C' + i + 'C', repText);
}
- text = globals.converter._dispatch('makehtml.unhashHTMLSpans.after', text, options, globals);
+ text = globals.converter._dispatch('makehtml.unhashHTMLSpans.after', text, options, globals).getText();
return text;
});
diff --git a/src/subParsers/makehtml/hashPreCodeTags.js b/src/subParsers/makehtml/hashPreCodeTags.js
index d8e4eab..e989ea9 100644
--- a/src/subParsers/makehtml/hashPreCodeTags.js
+++ b/src/subParsers/makehtml/hashPreCodeTags.js
@@ -3,7 +3,7 @@
*/
showdown.subParser('makehtml.hashPreCodeTags', function (text, options, globals) {
'use strict';
- text = globals.converter._dispatch('makehtml.hashPreCodeTags.before', text, options, globals);
+ text = globals.converter._dispatch('makehtml.hashPreCodeTags.before', text, options, globals).getText();
var repFunc = function (wholeMatch, match, left, right) {
// encode html entities
@@ -14,6 +14,6 @@ showdown.subParser('makehtml.hashPreCodeTags', function (text, options, globals)
// Hash
text = showdown.helper.replaceRecursiveRegExp(text, repFunc, '^ {0,3}]*>\\s*]*>', '^ {0,3}
\\s*
', 'gim');
- text = globals.converter._dispatch('makehtml.hashPreCodeTags.after', text, options, globals);
+ text = globals.converter._dispatch('makehtml.hashPreCodeTags.after', text, options, globals).getText();
return text;
});
diff --git a/src/subParsers/makehtml/headers.js b/src/subParsers/makehtml/headers.js
index a3aec07..e9f7aeb 100644
--- a/src/subParsers/makehtml/headers.js
+++ b/src/subParsers/makehtml/headers.js
@@ -1,7 +1,7 @@
showdown.subParser('makehtml.headers', function (text, options, globals) {
'use strict';
- text = globals.converter._dispatch('makehtml.headers.before', text, options, globals);
+ text = globals.converter._dispatch('makehtml.headers.before', text, options, globals).getText();
var headerLevelStart = (isNaN(parseInt(options.headerLevelStart))) ? 1 : parseInt(options.headerLevelStart),
@@ -121,6 +121,6 @@ showdown.subParser('makehtml.headers', function (text, options, globals) {
return title;
}
- text = globals.converter._dispatch('makehtml.headers.after', text, options, globals);
+ text = globals.converter._dispatch('makehtml.headers.after', text, options, globals).getText();
return text;
});
diff --git a/src/subParsers/makehtml/horizontalRule.js b/src/subParsers/makehtml/horizontalRule.js
index 7f076ff..fc87fd2 100644
--- a/src/subParsers/makehtml/horizontalRule.js
+++ b/src/subParsers/makehtml/horizontalRule.js
@@ -3,13 +3,13 @@
*/
showdown.subParser('makehtml.horizontalRule', function (text, options, globals) {
'use strict';
- text = globals.converter._dispatch('makehtml.horizontalRule.before', text, options, globals);
+ text = globals.converter._dispatch('makehtml.horizontalRule.before', text, options, globals).getText();
var key = showdown.subParser('makehtml.hashBlock')('
', options, globals);
text = text.replace(/^ {0,2}( ?-){3,}[ \t]*$/gm, key);
text = text.replace(/^ {0,2}( ?\*){3,}[ \t]*$/gm, key);
text = text.replace(/^ {0,2}( ?_){3,}[ \t]*$/gm, key);
- text = globals.converter._dispatch('makehtml.horizontalRule.after', text, options, globals);
+ text = globals.converter._dispatch('makehtml.horizontalRule.after', text, options, globals).getText();
return text;
});
diff --git a/src/subParsers/makehtml/images.js b/src/subParsers/makehtml/images.js
index 8380404..6ae02ef 100644
--- a/src/subParsers/makehtml/images.js
+++ b/src/subParsers/makehtml/images.js
@@ -4,7 +4,7 @@
showdown.subParser('makehtml.images', function (text, options, globals) {
'use strict';
- text = globals.converter._dispatch('makehtml.images.before', text, options, globals);
+ text = globals.converter._dispatch('makehtml.images.before', text, options, globals).getText();
var inlineRegExp = /!\[([^\]]*?)][ \t]*()\([ \t]?([\S]+?(?:\([\S]*?\)[\S]*?)?)>?(?: =([*\d]+[A-Za-z%]{0,4})x([*\d]+[A-Za-z%]{0,4}))?[ \t]*(?:(["'])([^"]*?)\6)?[ \t]?\)/g,
crazyRegExp = /!\[([^\]]*?)][ \t]*()\([ \t]?<([^>]*)>(?: =([*\d]+[A-Za-z%]{0,4})x([*\d]+[A-Za-z%]{0,4}))?[ \t]*(?:(?:(["'])([^"]*?)\6))?[ \t]?\)/g,
@@ -99,6 +99,6 @@ showdown.subParser('makehtml.images', function (text, options, globals) {
// handle reference-style shortcuts: ![img text]
text = text.replace(refShortcutRegExp, writeImageTag);
- text = globals.converter._dispatch('makehtml.images.after', text, options, globals);
+ text = globals.converter._dispatch('makehtml.images.after', text, options, globals).getText();
return text;
});
diff --git a/src/subParsers/makehtml/italicsAndBold.js b/src/subParsers/makehtml/italicsAndBold.js
index 12b8e0e..7a5d317 100644
--- a/src/subParsers/makehtml/italicsAndBold.js
+++ b/src/subParsers/makehtml/italicsAndBold.js
@@ -1,7 +1,7 @@
showdown.subParser('makehtml.italicsAndBold', function (text, options, globals) {
'use strict';
- text = globals.converter._dispatch('makehtml.italicsAndBold.before', text, options, globals);
+ text = globals.converter._dispatch('makehtml.italicsAndBold.before', text, options, globals).getText();
// it's faster to have 3 separate regexes for each case than have just one
// because of backtracing, in some cases, it could lead to an exponential effect
@@ -65,6 +65,6 @@ showdown.subParser('makehtml.italicsAndBold', function (text, options, globals)
}
- text = globals.converter._dispatch('makehtml.italicsAndBold.after', text, options, globals);
+ text = globals.converter._dispatch('makehtml.italicsAndBold.after', text, options, globals).getText();
return text;
});
diff --git a/src/subParsers/makehtml/lists.js b/src/subParsers/makehtml/lists.js
index be7e84a..224f795 100644
--- a/src/subParsers/makehtml/lists.js
+++ b/src/subParsers/makehtml/lists.js
@@ -175,7 +175,7 @@ showdown.subParser('makehtml.lists', function (text, options, globals) {
}
/** Start of list parsing **/
- text = globals.converter._dispatch('lists.before', text, options, globals);
+ text = globals.converter._dispatch('lists.before', text, options, globals).getText();
// add sentinel to hack around khtml/safari bug:
// http://bugs.webkit.org/show_bug.cgi?id=11231
text += '¨0';
@@ -198,6 +198,6 @@ showdown.subParser('makehtml.lists', function (text, options, globals) {
// strip sentinel
text = text.replace(/¨0/, '');
- text = globals.converter._dispatch('makehtml.lists.after', text, options, globals);
+ text = globals.converter._dispatch('makehtml.lists.after', text, options, globals).getText();
return text;
});
diff --git a/src/subParsers/makehtml/metadata.js b/src/subParsers/makehtml/metadata.js
index e248837..6f2405f 100644
--- a/src/subParsers/makehtml/metadata.js
+++ b/src/subParsers/makehtml/metadata.js
@@ -8,7 +8,7 @@ showdown.subParser('makehtml.metadata', function (text, options, globals) {
return text;
}
- text = globals.converter._dispatch('makehtml.metadata.before', text, options, globals);
+ text = globals.converter._dispatch('makehtml.metadata.before', text, options, globals).getText();
function parseMetadataContents (content) {
// raw is raw so it's not changed in any way
@@ -44,6 +44,6 @@ showdown.subParser('makehtml.metadata', function (text, options, globals) {
text = text.replace(/¨M/g, '');
- text = globals.converter._dispatch('makehtml.metadata.after', text, options, globals);
+ text = globals.converter._dispatch('makehtml.metadata.after', text, options, globals).getText();
return text;
});
diff --git a/src/subParsers/makehtml/outdent.js b/src/subParsers/makehtml/outdent.js
index 5bdc9f0..67f4106 100644
--- a/src/subParsers/makehtml/outdent.js
+++ b/src/subParsers/makehtml/outdent.js
@@ -3,7 +3,7 @@
*/
showdown.subParser('makehtml.outdent', function (text, options, globals) {
'use strict';
- text = globals.converter._dispatch('makehtml.outdent.before', text, options, globals);
+ text = globals.converter._dispatch('makehtml.outdent.before', text, options, globals).getText();
// attacklab: hack around Konqueror 3.5.4 bug:
// "----------bug".replace(/^-/g,"") == "bug"
@@ -12,6 +12,6 @@ showdown.subParser('makehtml.outdent', function (text, options, globals) {
// attacklab: clean up hack
text = text.replace(/¨0/g, '');
- text = globals.converter._dispatch('makehtml.outdent.after', text, options, globals);
+ text = globals.converter._dispatch('makehtml.outdent.after', text, options, globals).getText();
return text;
});
diff --git a/src/subParsers/makehtml/paragraphs.js b/src/subParsers/makehtml/paragraphs.js
index 4140285..81acdf3 100644
--- a/src/subParsers/makehtml/paragraphs.js
+++ b/src/subParsers/makehtml/paragraphs.js
@@ -4,7 +4,7 @@
showdown.subParser('makehtml.paragraphs', function (text, options, globals) {
'use strict';
- text = globals.converter._dispatch('makehtml.paragraphs.before', text, options, globals);
+ text = globals.converter._dispatch('makehtml.paragraphs.before', text, options, globals).getText();
// Strip leading and trailing lines:
text = text.replace(/^\n+/g, '');
text = text.replace(/\n+$/g, '');
@@ -66,5 +66,5 @@ showdown.subParser('makehtml.paragraphs', function (text, options, globals) {
// Strip leading and trailing lines:
text = text.replace(/^\n+/g, '');
text = text.replace(/\n+$/g, '');
- return globals.converter._dispatch('makehtml.paragraphs.after', text, options, globals);
+ return globals.converter._dispatch('makehtml.paragraphs.after', text, options, globals).getText();
});
diff --git a/src/subParsers/makehtml/spanGamut.js b/src/subParsers/makehtml/spanGamut.js
index be4a786..038743d 100644
--- a/src/subParsers/makehtml/spanGamut.js
+++ b/src/subParsers/makehtml/spanGamut.js
@@ -5,7 +5,7 @@
showdown.subParser('makehtml.spanGamut', function (text, options, globals) {
'use strict';
- text = globals.converter._dispatch('smakehtml.panGamut.before', text, options, globals);
+ text = globals.converter._dispatch('smakehtml.panGamut.before', text, options, globals).getText();
text = showdown.subParser('makehtml.codeSpans')(text, options, globals);
text = showdown.subParser('makehtml.escapeSpecialCharsWithinTagAttributes')(text, options, globals);
text = showdown.subParser('makehtml.encodeBackslashEscapes')(text, options, globals);
@@ -44,6 +44,6 @@ showdown.subParser('makehtml.spanGamut', function (text, options, globals) {
text = text.replace(/ +\n/g, '
\n');
}
- text = globals.converter._dispatch('makehtml.spanGamut.after', text, options, globals);
+ text = globals.converter._dispatch('makehtml.spanGamut.after', text, options, globals).getText();
return text;
});
diff --git a/src/subParsers/makehtml/strikethrough.js b/src/subParsers/makehtml/strikethrough.js
index b45d707..a6251fb 100644
--- a/src/subParsers/makehtml/strikethrough.js
+++ b/src/subParsers/makehtml/strikethrough.js
@@ -9,9 +9,9 @@ showdown.subParser('makehtml.strikethrough', function (text, options, globals) {
}
if (options.strikethrough) {
- text = globals.converter._dispatch('makehtml.strikethrough.before', text, options, globals);
+ text = globals.converter._dispatch('makehtml.strikethrough.before', text, options, globals).getText();
text = text.replace(/(?:~){2}([\s\S]+?)(?:~){2}/g, function (wm, txt) { return parseInside(txt); });
- text = globals.converter._dispatch('makehtml.strikethrough.after', text, options, globals);
+ text = globals.converter._dispatch('makehtml.strikethrough.after', text, options, globals).getText();
}
return text;
diff --git a/src/subParsers/makehtml/tables.js b/src/subParsers/makehtml/tables.js
index 060464f..eb2a4b7 100644
--- a/src/subParsers/makehtml/tables.js
+++ b/src/subParsers/makehtml/tables.js
@@ -70,6 +70,7 @@ showdown.subParser('makehtml.tables', function (text, options, globals) {
tableLines[i] = tableLines[i].replace(/\|[ \t]*$/, '');
}
// parse code spans first, but we only support one line code spans
+
tableLines[i] = showdown.subParser('makehtml.codeSpans')(tableLines[i], options, globals);
}
@@ -125,7 +126,7 @@ showdown.subParser('makehtml.tables', function (text, options, globals) {
return buildTable(headers, cells);
}
- text = globals.converter._dispatch('makehtml.tables.before', text, options, globals);
+ text = globals.converter._dispatch('makehtml.tables.before', text, options, globals).getText();
// find escaped pipe characters
text = text.replace(/\\(\|)/g, showdown.helper.escapeCharactersCallback);
@@ -136,7 +137,7 @@ showdown.subParser('makehtml.tables', function (text, options, globals) {
// parse one column tables
text = text.replace(singeColTblRgx, parseTable);
- text = globals.converter._dispatch('makehtml.tables.after', text, options, globals);
+ text = globals.converter._dispatch('makehtml.tables.after', text, options, globals).getText();
return text;
});
diff --git a/src/subParsers/makehtml/underline.js b/src/subParsers/makehtml/underline.js
index f832cb1..ad7f654 100644
--- a/src/subParsers/makehtml/underline.js
+++ b/src/subParsers/makehtml/underline.js
@@ -5,7 +5,7 @@ showdown.subParser('makehtml.underline', function (text, options, globals) {
return text;
}
- text = globals.converter._dispatch('makehtml.underline.before', text, options, globals);
+ text = globals.converter._dispatch('makehtml.underline.before', text, options, globals).getText();
if (options.literalMidWordUnderscores) {
text = text.replace(/\b_?__(\S[\s\S]*)___?\b/g, function (wm, txt) {
@@ -20,7 +20,7 @@ showdown.subParser('makehtml.underline', function (text, options, globals) {
// escape remaining underscores to prevent them being parsed by italic and bold
text = text.replace(/(_)/g, showdown.helper.escapeCharactersCallback);
- text = globals.converter._dispatch('makehtml.underline.after', text, options, globals);
+ text = globals.converter._dispatch('makehtml.underline.after', text, options, globals).getText();
return text;
});
diff --git a/src/subParsers/makehtml/unescapeSpecialChars.js b/src/subParsers/makehtml/unescapeSpecialChars.js
index 8fc266e..b96144e 100644
--- a/src/subParsers/makehtml/unescapeSpecialChars.js
+++ b/src/subParsers/makehtml/unescapeSpecialChars.js
@@ -3,13 +3,13 @@
*/
showdown.subParser('makehtml.unescapeSpecialChars', function (text, options, globals) {
'use strict';
- text = globals.converter._dispatch('makehtml.unescapeSpecialChars.before', text, options, globals);
+ text = globals.converter._dispatch('makehtml.unescapeSpecialChars.before', text, options, globals).getText();
text = text.replace(/¨E(\d+)E/g, function (wholeMatch, m1) {
var charCodeToReplace = parseInt(m1);
return String.fromCharCode(charCodeToReplace);
});
- text = globals.converter._dispatch('makehtml.unescapeSpecialChars.after', text, options, globals);
+ text = globals.converter._dispatch('makehtml.unescapeSpecialChars.after', text, options, globals).getText();
return text;
});
diff --git a/test/functional/makehtml/cases/features/emojis/special.html b/test/functional/makehtml/cases/features/emojis/special.html
index 236738f..b591c21 100644
--- a/test/functional/makehtml/cases/features/emojis/special.html
+++ b/test/functional/makehtml/cases/features/emojis/special.html
@@ -1,2 +1,2 @@
this is showdown's emoji ![](data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAMAAACdt4HsAAAAS1BMVEX///8jJS0jJS0jJS0jJS0jJS0jJS0jJS0jJS0jJS0jJS0jJS0jJS0jJS0jJS0jJS0jJS3b1q3b1q3b1q3b1q3b1q3b1q3b1q3b1q0565CIAAAAGXRSTlMAQHCAYCCw/+DQwPCQUBAwoHCAEP+wwFBgS2fvBgAAAUZJREFUeAHs1cGy7BAUheFFsEDw/k97VTq3T6ge2EmdM+pvrP6Iwd74XV9Kb52xuMU4/uc1YNgZLFOeV8FGdhGrNk5SEgUyPxAEdj4LlMRDyhVAMVEa2M7TBSeVZAFPdqHgzSZJwPKgcLFLAooHDJo4EDCw4gAtBoJA5UFj4Ng5LOGLwVXZuoIlji/jeQHFk7+baHxrCjeUwB9+s88KndvlhcyBN5BSkYNQIVVb4pV+Npm7hhuKDs/uMP5KxT3WzSNNLIuuoDpMmuAVMruMSeDyQBi24DTr43LAY7ILA1QYaWkgfHzFthYYzg67SQsCbB8GhJUEGCtO9n0rSaCLxgJQjS/JSgMTg2eBDEHAJ+H350AsjYNYscrErgI2e/l+mdR967TCX/v6N0EhPECYCP0i+IAoYQOE8BogNhQMEMdrgAQWHaMAAGi5I5euoY9NAAAAAElFTkSuQmCC)
-and this is github's emoji ![](data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAOwUlEQVR42uVbCVyO6RbPmn0sw9gZS0aZO4y5GTEUE2ObxjZjrbHEJVy3sWS5pkaWxjLEkCVDSbSgFLdESaWSLIVUSIi4kvb9f895vi/zbbR+yZ339/tbnu99n/ec/3Oe85xznufV0CjDBaAdwZqwn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+A4j4i4TNpltiJ8LPiNFFFwNGjRyWFyfedAFUny/joekkEuLi4KK0CfykCeFnkiu1flgBeFtl3/D8SsMbKykpOifv37ysRcPz4cVHKUiSA8wwNdR9/VTMBSh9Y8S4Nf2qnSICiBbDzVCRg9uzZTMC+94kAv6FDh8opwRsVHPjItnl4eEDxHNLKlStFXV+2javQ/M1SpZe+1KA4L4G7WDG57fSm/OUbXiqG0ewAFYOeYcN4fwZhvLkp2y4tftrxcltdlf/w+fPn4qNGxTCYU2m6nrRu3VqunT/EoiuZvw6TTZHpyuNNmEaNGsndP3fu3OJAq1N1JOAHDmyKheVtNP4OkE2crULRAW7fvl20EyyLy24a8p+/7WISFixYIMLt4t82bNhQYjXqXREgPq3j74mlX3AmSL8E1eOPIBXnuVT5OsVZpuLnOMeOHeN7vifwiYhYzhC5IpwlOXj1QXWdBmy/XWU/X+UqMZfKBw4cKAobHPlJlZe9h6tOu+7cuSN2dg0MDMSSyZUpmXvaSD+crq/xvl0k9BTCRa7qEPq+5T4t6ffF52WVV+f1P6zyLG30bsU4AAAAAElFTkSuQmCC)
\ No newline at end of file
+and this is github's emoji ![](https://assets-cdn.github.com/images/icons/emoji/octocat.png)
diff --git a/test/unit/showdown.Converter.js b/test/unit/showdown.Converter.js
index d215441..b6ee9ee 100644
--- a/test/unit/showdown.Converter.js
+++ b/test/unit/showdown.Converter.js
@@ -126,19 +126,19 @@ describe('showdown.Converter', function () {
describe('events', function () {
var events = [
- 'anchors',
- 'autoLinks',
- 'blockGamut',
- 'blockQuotes',
- 'codeBlocks',
- 'codeSpans',
- 'githubCodeBlocks',
- 'headers',
- 'images',
- 'italicsAndBold',
- 'lists',
- 'paragraph',
- 'spanGamut'
+ 'makehtml.anchors',
+ 'makehtml.autoLinks',
+ 'makehtml.blockGamut',
+ 'makehtml.blockQuotes',
+ 'makehtml.codeBlocks',
+ 'makehtml.codeSpans',
+ 'makehtml.githubCodeBlocks',
+ 'makehtml.headers',
+ 'makehtml.images',
+ 'makehtml.italicsAndBold',
+ 'makehtml.lists',
+ 'makehtml.paragraph',
+ 'makehtml.spanGamut'
//'strikeThrough',
//'tables'
];
@@ -151,8 +151,10 @@ describe('showdown.Converter', function () {
function runListener (name) {
it('should listen to ' + name, function () {
var converter = new showdown.Converter();
- converter.listen(name, function (evtName, text) {
- evtName.should.equal(name);
+ converter.listen(name, function (event) {
+ var evtName = event.getName();
+ var text = event.getCapturedText();
+ evtName.should.equal(name.toLowerCase());
text.should.match(/^[\s\S]*foo[\s\S]*$/);
return text;
})