aboutsummaryrefslogtreecommitdiff
path: root/templates
diff options
context:
space:
mode:
authorBobby <[email protected]>2023-06-06 17:09:35 -0400
committerBobby <[email protected]>2023-06-06 17:09:35 -0400
commit5781f104d7ea2a709c1ca3266c407e15224f18b7 (patch)
tree9a69a0f77e515ed24262ffe45b5ca72d55cb1088 /templates
parent55194bc9de5f15c07bd4ff8d7ece9da5c8ed938d (diff)
downloadthatcomputerscientist-5781f104d7ea2a709c1ca3266c407e15224f18b7.tar.xz
thatcomputerscientist-5781f104d7ea2a709c1ca3266c407e15224f18b7.zip
Move Mathjax Config to Back to Partial
Diffstat (limited to 'templates')
-rw-r--r--templates/blog/partials/mathjax.html56
1 files changed, 55 insertions, 1 deletions
diff --git a/templates/blog/partials/mathjax.html b/templates/blog/partials/mathjax.html
index 5f80d390..dd1944d4 100644
--- a/templates/blog/partials/mathjax.html
+++ b/templates/blog/partials/mathjax.html
@@ -1,3 +1,57 @@
{% load static %}
<script type="text/javascript" src="{% static 'js/MathJax/MathJax.js' %}?config=default"></script>
-<script type="text/x-mathjax-config" src="{% static 'js/mjxConfig.js' %}"></script>
+<script type="text/x-mathjax-config">
+ var BROWSER = MathJax.Hub.Browser;
+
+var canUseMML =
+ (BROWSER.isFirefox && BROWSER.versionAtLeast("1.5")) ||
+ (BROWSER.isMSIE && BROWSER.hasMathPlayer) ||
+ (BROWSER.isSafari && BROWSER.versionAtLeast("5.0")) ||
+ (BROWSER.isOpera &&
+ BROWSER.versionAtLeast("9.52") &&
+ !BROWSER.versionAtLeast("14.0"));
+
+var CONFIG = MathJax.Hub.CombineConfig("default", {
+ prefer: {
+ MSIE: "HTML",
+ Firefox: "HTML",
+ Opera: "HTML",
+ Chrome: "CommonHTML",
+ Safari: "HTML",
+ other: "HTML",
+ },
+});
+
+var jax = CONFIG.prefer[BROWSER] || CONFIG.prefer.other;
+if (jax === "HTML") jax = "HTML-CSS";
+else if (jax === "MML") jax = "NativeMML";
+if (jax === "NativeMML" && !canUseMML) jax = CONFIG.prefer.other;
+
+MathJax.Hub.Config({
+ jax: ["input/TeX", "output/" + jax],
+ extensions: ["tex2jax.js"],
+ TeX: {
+ extensions: [
+ "AMSmath.js",
+ "AMSsymbols.js",
+ "noErrors.js",
+ "noUndefined.js",
+ ],
+ },
+ "HTML-CSS": { availableFonts: ["TeX"] },
+ tex2jax: {
+ inlineMath: [
+ ["$", "$"],
+ ["\\(", "\\)"],
+ ],
+ displayMath: [
+ ["$$", "$$"],
+ ["\\[", "\\]"],
+ ],
+ processEscapes: true,
+ },
+ "fast-preview": { disabled: true },
+ showProcessingMessages: false,
+ "HTML-CSS": { imageFont: null },
+});
+</script>