(function(document) { if ((typeof window.MathJax != 'undefined') && (typeof window.MathJax.Hub != 'undefined')) { // Apply MathJax typesetting var mathjaxDiv = document.getElementById(config.mathjaxProcessingElementId); // Apply Markdown parser after MathJax typesetting is complete window.MathJax.Hub.Queue(["Typeset", window.MathJax.Hub, mathjaxDiv]); window.MathJax.Hub.Register.StartupHook("End Typeset", function () { // BUG: CWE-79 Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') // // FIXED: config.markedOptions.sanitize = false; marked.setOptions(config.markedOptions); // Decode < and > mathjaxData = mathjaxDiv.innerHTML; mathjaxData = mathjaxData.replace(/</g, "<"); mathjaxData = mathjaxData.replace(/>/g, ">"); // Convert Markdown to HTML and replace document body var html = marked(mathjaxData); document.body.innerHTML = html; // Remove div used for MathJax processing mathjaxDiv.remove(); } ); } }(document));