openct-tasks/_common/modules/pemFioi/post_processor.js

26 lines
763 B
JavaScript

// markdown & mathjax
(function() {
function markdown() {
if(!window.showdown) return;
var showdownConverter = new showdown.Converter({
headerLevelStart: 3,
backslashEscapesHTMLTags: true
});
$('.markdown').each(function() {
var newDiv = $('<div></div>'), el = $(this);
newDiv.html(showdownConverter.makeHtml(el.html()));
newDiv.addClass('markdown-translated');
newDiv.insertAfter(el);
el.remove();
});
}
if(window.MathJax) {
MathJax.Hub.Config({
tex2jax: {inlineMath: [['$','$'], ['\\(','\\)']]}
});
MathJax.Hub.Queue(markdown);
} else {
$(document).ready(markdown);
}
})()