-
Notifications
You must be signed in to change notification settings - Fork 160
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Configure le bon chemin pour les extensions MathJax (#6691)
- Loading branch information
Showing
3 changed files
with
42 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,44 @@ | ||
{% load static %} | ||
|
||
<script type="text/x-mathjax-config"> | ||
MathJax.Hub.Config({ | ||
root: "/static/js", | ||
tex2jax: { | ||
inlineMath: [['$', '$']], | ||
displayMath: [['$$','$$']], | ||
processEscapes: true, | ||
processClass: "mathjax-wrapper|mathjax-span", | ||
ignoreClass: "page-container" | ||
}, | ||
TeX: { extensions: ["color.js", "cancel.js", "enclose.js", "bbox.js", "mathchoice.js", "newcommand.js", "verb.js", "unicode.js", "autobold.js", "mhchem.js"] }, | ||
messageStyle: "none", | ||
}); | ||
</script> | ||
|
||
<script type="application/javascript"> | ||
// When the page has been loaded (which means the DOM and Mathjax has been loaded) | ||
window.addEventListener("load", function() { | ||
|
||
// We look for <span> inside contents | ||
$(".message-content span, .article-content span").each(function () { | ||
// We only want those with no CSS class | ||
if($(this).attr("class") === undefined) { | ||
var text = $(this).text(); | ||
// We check that they start with $ and end with $ | ||
if (text && text[0] == "$" && text[text.length - 1] == "$") { | ||
// We add a class to mark them | ||
$(this).addClass("mathjax-span"); | ||
} | ||
} | ||
}); | ||
|
||
// If there is content waiting for Mathjax | ||
if($(".mathjax-span, .mathjax-wrapper").length) { | ||
// We run Mathjax | ||
MathJax.Hub.Configured(); | ||
} | ||
|
||
}); | ||
</script> | ||
|
||
<script src="{% static "js/MathJax.js" %}?locale=fr&config=TeX-AMS_HTML&delayStartupUntil=configured" async></script> |
This file was deleted.
Oops, something went wrong.