online-judge/resources/pagedown_math.js
Tudor Brindus c126f07fe7 Revert "Completely remove Pagedown" and "Switch all Pagedown editors to Martor"
This reverts commits:
- 2035e606f3
- ce1196f74f

Since they do not interact well with dark mode.
2023-12-25 12:17:56 -05:00

20 lines
577 B
JavaScript

function mathjax_pagedown($) {
if ('MathJax' in window) {
$.each(window.editors, function (id, editor) {
var preview = $('div.wmd-preview#' + id + '_wmd_preview')[0];
if (preview) {
editor.hooks.chain('onPreviewRefresh', function () {
MathJax.typeset([preview]);
});
MathJax.typeset([preview]);
}
});
}
}
window.mathjax_pagedown = mathjax_pagedown;
$(window).on('load', function () {
(mathjax_pagedown)('$' in window ? $ : django.jQuery);
});