|
@@ -1755,6 +1755,25 @@ showdown.subParser('hashBlock', function (text, options, globals) {
|
|
|
return text;
|
|
|
});
|
|
|
|
|
|
+/**
|
|
|
+ * Hash and escape <code> elements that should not be parsed as markdown
|
|
|
+ */
|
|
|
+showdown.subParser('hashCodeTags', function (text, options, globals) {
|
|
|
+ 'use strict';
|
|
|
+ text = globals.converter._dispatch('hashCodeTags.before', text, options, globals);
|
|
|
+
|
|
|
+ var repFunc = function (wholeMatch, match, left, right) {
|
|
|
+ var codeblock = left + showdown.subParser('encodeCode')(match, options, globals) + right;
|
|
|
+ return '¨C' + (globals.gHtmlSpans.push(codeblock) - 1) + 'C';
|
|
|
+ };
|
|
|
+
|
|
|
+ // Hash naked <code>
|
|
|
+ text = showdown.helper.replaceRecursiveRegExp(text, repFunc, '<code\\b[^>]*>', '</code>', 'gim');
|
|
|
+
|
|
|
+ text = globals.converter._dispatch('hashCodeTags.after', text, options, globals);
|
|
|
+ return text;
|
|
|
+});
|
|
|
+
|
|
|
showdown.subParser('hashElement', function (text, options, globals) {
|
|
|
'use strict';
|
|
|
|
|
@@ -1911,7 +1930,7 @@ showdown.subParser('unhashHTMLSpans', function (text, options, globals) {
|
|
|
});
|
|
|
|
|
|
/**
|
|
|
- * Hash span elements that should not be parsed as markdown
|
|
|
+ * Hash and escape <pre><code> elements that should not be parsed as markdown
|
|
|
*/
|
|
|
showdown.subParser('hashPreCodeTags', function (text, options, globals) {
|
|
|
'use strict';
|
|
@@ -1929,18 +1948,6 @@ showdown.subParser('hashPreCodeTags', function (text, options, globals) {
|
|
|
text = globals.converter._dispatch('hashPreCodeTags.after', text, options, globals);
|
|
|
return text;
|
|
|
});
|
|
|
-
|
|
|
-showdown.subParser('hashCodeTags', function (text, options, globals) {
|
|
|
- 'use strict';
|
|
|
- text = globals.converter._dispatch('hashCodeTags.before', text, options, globals);
|
|
|
- // Hash naked <code>
|
|
|
- var matches = showdown.helper.matchRecursiveRegExp(text, '<code\\b[^>]*>', '</code>', '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 = globals.converter._dispatch('hashCodeTags.after', text, options, globals);
|
|
|
- return text;
|
|
|
-});
|
|
|
|
|
|
showdown.subParser('headers', function (text, options, globals) {
|
|
|
'use strict';
|