diff --git a/dist/showdown.js b/dist/showdown.js
index dbec2e3..1c23ba7 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 ee3f236..690562e 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 b95e39d..32129b8 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 71a943d..bb085ef 100644
Binary files a/dist/showdown.min.js.map and b/dist/showdown.min.js.map differ
diff --git a/src/angular.js b/src/angular.js
index 459753d..f652dbc 100644
--- a/src/angular.js
+++ b/src/angular.js
@@ -9,9 +9,10 @@ if (typeof angular !== 'undefined' && typeof showdown !== 'undefined') {
(function (module, showdown) {
'use strict';
- module.provider('$showdown', provider).directive('sdModelToHtml',
- ['$showdown', markdownToHtmlDirective]).filter('sdStripHtml',
- stripHtmlFilter);
+ module
+ .provider('$showdown', provider)
+ .directive('sdModelToHtml',['$showdown', markdownToHtmlDirective])
+ .filter('sdStripHtml', stripHtmlFilter);
/**
* Angular Provider
diff --git a/src/loader.js b/src/loader.js
index 2d6b05b..6fceaa5 100644
--- a/src/loader.js
+++ b/src/loader.js
@@ -11,6 +11,7 @@ if (typeof module !== 'undefined' && module.exports) {
// AMD Loader
else if (typeof define === 'function' && define.amd) {
define('showdown', function () {
+ 'use strict';
return showdown;
});
}
diff --git a/src/subParsers/autoLinks.js b/src/subParsers/autoLinks.js
index e7857e8..3931978 100644
--- a/src/subParsers/autoLinks.js
+++ b/src/subParsers/autoLinks.js
@@ -5,7 +5,7 @@
showdown.subParser('autoLinks', function (text) {
'use strict';
- text = text.replace(/<((https?|ftp|dict):[^'">\s]+)>/gi, "$1");
+ text = text.replace(/<((https?|ftp|dict):[^'">\s]+)>/gi, '$1');
// Email addresses:
@@ -19,9 +19,10 @@ showdown.subParser('autoLinks', function (text) {
[-a-z0-9]+(\.[-a-z0-9]+)*\.[a-z]+
)
>
- /gi, _DoAutoLinks_callback());
+ /gi);
*/
- text = text.replace(/<(?:mailto:)?([-.\w]+\@[-a-z0-9]+(\.[-a-z0-9]+)*\.[a-z]+)>/gi, function (wholeMatch, m1) {
+ var pattern = /<(?:mailto:)?([-.\w]+\@[-a-z0-9]+(\.[-a-z0-9]+)*\.[a-z]+)>/gi;
+ text = text.replace(pattern, function (wholeMatch, m1) {
var unescapedStr = showdown.subParser('unescapeSpecialChars')(m1);
return showdown.subParser('encodeEmailAddress')(unescapedStr);
});
diff --git a/src/subParsers/codeBlocks.js b/src/subParsers/codeBlocks.js
index 97c80ed..32d50ec 100644
--- a/src/subParsers/codeBlocks.js
+++ b/src/subParsers/codeBlocks.js
@@ -24,20 +24,20 @@ showdown.subParser('codeBlocks', function (text, options, globals) {
// attacklab: sentinel workarounds for lack of \A and \Z, safari\khtml bug
text += '~0';
- text = text.replace(/(?:\n\n|^)((?:(?:[ ]{4}|\t).*\n+)+)(\n*[ ]{0,3}[^ \t\n]|(?=~0))/g,
- function (wholeMatch, m1, m2) {
- var codeblock = m1, nextChar = m2;
+ 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;
- codeblock = showdown.subParser('outdent')(codeblock);
- codeblock = showdown.subParser('encodeCode')(codeblock);
- codeblock = showdown.subParser('detab')(codeblock);
- codeblock = codeblock.replace(/^\n+/g, ''); // trim leading newlines
- codeblock = codeblock.replace(/\n+$/g, ''); // trim trailing whitespace
+ codeblock = showdown.subParser('outdent')(codeblock);
+ codeblock = showdown.subParser('encodeCode')(codeblock);
+ codeblock = showdown.subParser('detab')(codeblock);
+ codeblock = codeblock.replace(/^\n+/g, ''); // trim leading newlines
+ codeblock = codeblock.replace(/\n+$/g, ''); // trim trailing whitespace
- codeblock = '' + codeblock + '\n
';
+ codeblock = '' + codeblock + '\n
';
- return showdown.subParser('hashBlock')(codeblock, options, globals) + nextChar;
- });
+ return showdown.subParser('hashBlock')(codeblock, options, globals) + nextChar;
+ });
// attacklab: strip sentinel
text = text.replace(/~0/, '');
diff --git a/src/subParsers/detab.js b/src/subParsers/detab.js
index 8bd4307..08ba0db 100644
--- a/src/subParsers/detab.js
+++ b/src/subParsers/detab.js
@@ -16,7 +16,8 @@ showdown.subParser('detab', function (text) {
// use the sentinel to anchor our regex so it doesn't explode
text = text.replace(/~B(.+?)~A/g, function (wholeMatch, m1) {
- var leadingText = m1, numSpaces = 4 - leadingText.length % 4; // g_tab_width
+ var leadingText = m1,
+ numSpaces = 4 - leadingText.length % 4; // g_tab_width
// there *must* be a better way to do this:
for (var i = 0; i < numSpaces; i++) {
diff --git a/src/subParsers/encodeCode.js b/src/subParsers/encodeCode.js
index 27b51e5..9feb4f2 100644
--- a/src/subParsers/encodeCode.js
+++ b/src/subParsers/encodeCode.js
@@ -29,5 +29,4 @@ showdown.subParser('encodeCode', function (text) {
// ---
return text;
-
});
diff --git a/src/subParsers/encodeEmailAddress.js b/src/subParsers/encodeEmailAddress.js
index 9e15b5f..6a7b734 100644
--- a/src/subParsers/encodeEmailAddress.js
+++ b/src/subParsers/encodeEmailAddress.js
@@ -23,9 +23,11 @@ showdown.subParser('encodeEmailAddress', function (addr) {
var encode = [
function (ch) {
return '' + ch.charCodeAt(0) + ';';
- }, function (ch) {
+ },
+ function (ch) {
return '' + ch.charCodeAt(0).toString(16) + ';';
- }, function (ch) {
+ },
+ function (ch) {
return ch;
}
];
@@ -51,5 +53,4 @@ showdown.subParser('encodeEmailAddress', function (addr) {
addr = addr.replace(/">.+:/g, '">'); // strip the mailto: from the visible part
return addr;
-
});
diff --git a/src/subParsers/githubCodeBlocks.js b/src/subParsers/githubCodeBlocks.js
index f8141bc..2bbaa6e 100644
--- a/src/subParsers/githubCodeBlocks.js
+++ b/src/subParsers/githubCodeBlocks.js
@@ -18,7 +18,9 @@ showdown.subParser('githubCodeBlocks', function (text, options, globals) {
text += '~0';
text = text.replace(/(?:^|\n)```(.*)\n([\s\S]*?)\n```/g, function (wholeMatch, m1, m2) {
- var language = m1, codeblock = m2, end = '\n';
+ var language = m1,
+ codeblock = m2,
+ end = '\n';
if (options.omitExtraWLInCodeBlocks) {
end = '';
diff --git a/src/subParsers/headers.js b/src/subParsers/headers.js
index d19f249..a4ab4c4 100644
--- a/src/subParsers/headers.js
+++ b/src/subParsers/headers.js
@@ -15,17 +15,15 @@ showdown.subParser('headers', function (text, options, globals) {
// --------
//
text = text.replace(/^(.+)[ \t]*\n=+[ \t]*\n+/gm, function (wholeMatch, m1) {
- return showdown.subParser('hashBlock')('',
- options, globals);
+ var spanGamut = showdown.subParser('spanGamut')(m1, options, globals),
+ hashBlock = '';
+ return showdown.subParser('hashBlock')(hashBlock, options, globals);
});
text = text.replace(/^(.+)[ \t]*\n-+[ \t]*\n+/gm, function (matchFound, m1) {
- return showdown.subParser('hashBlock')('',
- options, globals);
+ var spanGamut = showdown.subParser('spanGamut')(m1, options, globals),
+ hashBlock = '';
+ return showdown.subParser('hashBlock')(hashBlock, options, globals);
});
// atx-style headers:
@@ -48,8 +46,8 @@ showdown.subParser('headers', function (text, options, globals) {
*/
text = text.replace(/^(\#{1,6})[ \t]*(.+?)[ \t]*\#*\n+/gm, function (wholeMatch, m1, m2) {
- var span = showdown.subParser('spanGamut')(m2, options,
- globals), header = '';
+ var span = showdown.subParser('spanGamut')(m2, options, globals),
+ header = '';
return showdown.subParser('hashBlock')(header, options, globals);
});
diff --git a/src/subParsers/images.js b/src/subParsers/images.js
index cf96174..0367559 100644
--- a/src/subParsers/images.js
+++ b/src/subParsers/images.js
@@ -11,7 +11,12 @@ showdown.subParser('images', function (text, options, globals) {
var writeImageTag = function (wholeMatch, m1, m2, m3, m4, m5, m6, m7) {
wholeMatch = m1;
- var altText = m2, linkId = m3.toLowerCase(), url = m4, title = m7, gUrls = globals.gUrls, gTitles = globals.gTitles;
+ var altText = m2,
+ linkId = m3.toLowerCase(),
+ url = m4,
+ title = m7,
+ gUrls = globals.gUrls,
+ gTitles = globals.gTitles;
if (!title) {
title = '';
diff --git a/src/subParsers/lists.js b/src/subParsers/lists.js
index c8256ef..ef9e2ca 100644
--- a/src/subParsers/lists.js
+++ b/src/subParsers/lists.js
@@ -109,7 +109,8 @@ showdown.subParser('lists', function (text, options, globals) {
if (globals.gListLevel) {
text = text.replace(wholeList, function (wholeMatch, m1, m2) {
- var list = m1, listType = (m2.search(/[*+-]/g) > -1) ? 'ul' : 'ol';
+ var list = m1,
+ listType = (m2.search(/[*+-]/g) > -1) ? 'ul' : 'ol';
// Turn double returns into triple returns, so that we can make a
// paragraph for the last item in a list, if necessary:
@@ -132,8 +133,9 @@ showdown.subParser('lists', function (text, options, globals) {
// Turn double returns into triple returns, so that we can make a
// paragraph for the last item in a list, if necessary:
- var list = m2.replace(/\n{2,}/g,
- '\n\n\n'), listType = (m3.search(/[*+-]/g) > -1) ? 'ul' : 'ol', result = processListItems(list);
+ var list = m2.replace(/\n{2,}/g, '\n\n\n'),
+ listType = (m3.search(/[*+-]/g) > -1) ? 'ul' : 'ol',
+ result = processListItems(list);
return m1 + '<' + listType + '>\n' + result + '' + listType + '>\n';
});
diff --git a/src/subParsers/stripLinkDefinitions.js b/src/subParsers/stripLinkDefinitions.js
index e7dacec..7e7dad4 100644
--- a/src/subParsers/stripLinkDefinitions.js
+++ b/src/subParsers/stripLinkDefinitions.js
@@ -30,25 +30,26 @@
showdown.subParser('stripLinkDefinitions', function (text, options, globals) {
'use strict';
+ var regex = /^[ ]{0,3}\[(.+)]:[ \t]*\n?[ \t]*(\S+?)>?[ \t]*\n?[ \t]*(?:(\n*)["(](.+?)[")][ \t]*)?(?:\n+|(?=~0))/gm;
+
// attacklab: sentinel workarounds for lack of \A and \Z, safari\khtml bug
text += '~0';
- 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();
- globals.gUrls[m1] = showdown.subParser('encodeAmpsAndAngles')(m2); // Link IDs are
- // case-insensitive
- if (m3) {
- // Oops, found blank lines, so it's not a title.
- // Put back the parenthetical statement we stole.
- return m3 + m4;
- } else if (m4) {
- globals.gTitles[m1] = m4.replace(/"/g, '"');
- }
+ text = text.replace(regex, function (wholeMatch, m1, m2, m3, m4) {
+ m1 = m1.toLowerCase();
+ globals.gUrls[m1] = showdown.subParser('encodeAmpsAndAngles')(m2); // Link IDs are case-insensitive
+ if (m3) {
+ // Oops, found blank lines, so it's not a title.
+ // Put back the parenthetical statement we stole.
+ return m3 + m4;
- // Completely remove the definition from the text
- return '';
- });
+ } else if (m4) {
+ globals.gTitles[m1] = m4.replace(/"/g, '"');
+ }
+
+ // Completely remove the definition from the text
+ return '';
+ });
// attacklab: strip sentinel
text = text.replace(/~0/, '');
diff --git a/test/cases/escaped-number-period.md b/test/cases/escaped-number-period.md
index d321a38..654761b 100644
--- a/test/cases/escaped-number-period.md
+++ b/test/cases/escaped-number-period.md
@@ -1 +1 @@
-It happened in 1986\. What a great season.
\ No newline at end of file
+It happened in 1986\. What a great season.
diff --git a/test/cases/horizontal-rules.html b/test/cases/horizontal-rules.html
index 5dd0402..aaef23e 100644
--- a/test/cases/horizontal-rules.html
+++ b/test/cases/horizontal-rules.html
@@ -1,9 +1,9 @@
-
+
-
+
-
+
-
+
-
+
diff --git a/test/cases/html5-strutural-tags.html b/test/cases/html5-strutural-tags.html
index 8e0d4b4..372c7f3 100644
--- a/test/cases/html5-strutural-tags.html
+++ b/test/cases/html5-strutural-tags.html
@@ -13,8 +13,7 @@
read
- me
-
+ me