/** Converts <>&" to their HTML escape sequences */ function escapeHTMLEntities(str) { return String(str).replace(/&/g, '&').replace(//g, '>').replace(/"/g, '"'); } /** Restores the original source string's '<' and '>' as entered in the document, before the browser processed it as HTML. There is no way in an HTML document to distinguish an entity that was entered as an entity.*/ function unescapeHTMLEntities(str) { // Process & last so that we don't recursively unescape // escaped escape sequences. return str. replace(/</g, '<'). replace(/>/g, '>'). replace(/"/g, '"'). replace(/'/g, "'"). replace(/–/g, '--'). replace(/—/g, '---'). replace(/&/g, '&'); } /** \param node A node from an HTML DOM \return A String that is a very good reconstruction of what the original source looked like before the browser tried to correct it to legal HTML. */ function nodeToMarkdeepSource(node, leaveEscapes) { var source = node.innerHTML; // Markdown uses e-mail syntax, which HTML parsing // will try to close by inserting the matching close tags at the end of the // document. Remove anything that looks like that and comes *after* // the first fallback style. source = source.replace(/(?:\r\n\ \r\n\ \r\n\ \r\n\ \ '; // This code is placed at the beginning of the body before the Markdeep code. // $ (DOCUMENT_BODY_PREFIX) is everything in the body of PreviewBlogPage.htm up to // $ (ARTICLE_HTML_CODE). DocumentBodyPrefix='\ \r\n\ \ \
\
';
// This code is placed at the end of the body after the Markdeep code. 
// $ (DOCUMENT_BODY_SUFFIX) is everything in the body of PreviewBlogPage.htm after 
// $ (ARTICLE_HTML_CODE).
DocumentBodySuffix='\
	
\ \
Document <body> code:
\
\ \r\n\ \ '; // Get the full Markdeep code from the .md.html file without the script invocation MarkdeepCode=nodeToMarkdeepSource(document.body); MarkdeepCode=MarkdeepCode.slice(0,MarkdeepCode.lastIndexOf("