Move from mathjax to katex
This commit is contained in:
parent
b2c9be7bda
commit
08d2437d49
35 changed files with 64 additions and 214 deletions
|
@ -1,33 +1,6 @@
|
|||
<script src="{{ static('libs/featherlight/featherlight.min.js') }}" type="text/javascript"></script>
|
||||
{% compress js %}
|
||||
{{ comment_form.media.js }}
|
||||
{% if not REQUIRE_JAX %}
|
||||
<script type="text/javascript">
|
||||
$(function () {
|
||||
$('#id_body').keypress(function () {
|
||||
if (!("MathJax" in window)) {
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: '{{ static('mathjax3_config.js') }}',
|
||||
dataType: "script",
|
||||
cache: true,
|
||||
success: function () {
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: 'https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-chtml.js',
|
||||
dataType: "script",
|
||||
cache: true,
|
||||
success: function () {
|
||||
mathjax_pagedown($);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
{% endif %}
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function () {
|
||||
let loading_gif = "<img src=\"{{static('loading.gif')}}\" style=\"height: 3em; margin-bottom: 3px\" class=\"loading\">";
|
||||
|
@ -61,10 +34,8 @@
|
|||
});
|
||||
|
||||
function update_math($comment) {
|
||||
if ('MathJax' in window) {
|
||||
var $body = $comment.find('.comment-body');
|
||||
MathJax.typeset($body[0]);
|
||||
}
|
||||
var $body = $comment.find('.comment-body');
|
||||
renderKatex($body[0]);
|
||||
}
|
||||
|
||||
window.show_revision = function (comment_id, offset) {
|
||||
|
@ -145,7 +116,7 @@
|
|||
$comment_loading.hide();
|
||||
var $comment = $("#comment-" + id + "-children");
|
||||
$comment.append(data);
|
||||
MathJax.typeset($('#comments')[0]);
|
||||
renderKatex($('#comments')[0]);
|
||||
register_time($('.time-with-rel'));
|
||||
}
|
||||
})
|
||||
|
@ -188,7 +159,7 @@
|
|||
var $comment = $("#comment-" + id + "-children");
|
||||
$comment.append(data);
|
||||
}
|
||||
MathJax.typeset($('#comments')[0]);
|
||||
renderKatex($('#comments')[0]);
|
||||
register_time($('.time-with-rel'));
|
||||
}
|
||||
})
|
||||
|
@ -246,7 +217,7 @@
|
|||
window.DjangoPagedown.createEditor($wmd.get(0));
|
||||
if ('MathJax' in window) {
|
||||
var preview = $('.featherlight div.wmd-preview')[0];
|
||||
MathJax.typeset(preview);
|
||||
renderKatex(preview);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue