showdown.subParser('hashHTMLBlocks', function (text, options, globals) { 'use strict'; var blockTags = [ 'pre', 'div', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'blockquote', 'table', 'dl', 'ol', 'ul', 'script', 'noscript', 'form', 'fieldset', 'iframe', 'math', 'style', 'section', 'header', 'footer', 'nav', 'article', 'aside', 'address', 'audio', 'canvas', 'figure', 'hgroup', 'output', 'video', 'p' ], repFunc = function (wholeMatch, match, left, right) { var txt = wholeMatch; // check if this html element is marked as markdown // if so, it's contents should be parsed as markdown 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'; }; for (var i = 0; i < blockTags.length; ++i) { text = showdown.helper.replaceRecursiveRegExp(text, repFunc, '^(?: |\\t){0,3}<' + blockTags[i] + '\\b[^>]*>', '', 'gim'); } // HR SPECIAL CASE text = text.replace(/(\n[ ]{0,3}(<(hr)\b([^<>])*?\/?>)[ \t]*(?=\n{2,}))/g, showdown.subParser('hashElement')(text, options, globals)); // Special case for standalone HTML comments: text = text.replace(/([ \t]*(?=\n{2,}))/g, showdown.subParser('hashElement')(text, options, globals)); // PHP and ASP-style processor instructions ( and <%...%>) text = text.replace(/(?:\n\n)([ ]{0,3}(?:<([?%])[^\r]*?\2>)[ \t]*(?=\n{2,}))/g, showdown.subParser('hashElement')(text, options, globals)); return text; });