Skip to content

Commit cd7af17

Browse files
committed
load MathJax on pages that declare the stem attribute
1 parent 7af6a52 commit cd7af17

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

src/partials/footer-scripts.hbs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,26 @@
11
<script src="{{{uiRootPath}}}/js/site.js"></script>
22
<script async src="{{{uiRootPath}}}/js/vendor/highlight.js"></script>
3+
{{#with (resolvePage page.relativeSrcPath model=false)}}
4+
{{#unless (eq ./asciidoc.attributes.stem undefined)}}
5+
<script type="text/x-mathjax-config">
6+
MathJax.Hub.Config({
7+
messageStyle: "none",
8+
tex2jax: { inlineMath: [["\\(", "\\)"]], displayMath: [["\\[", "\\]"]], ignoreClass: "nostem|nolatexmath" },
9+
asciimath2jax: { delimiters: [["\\$", "\\$"]], ignoreClass: "nostem|noasciimath" },
10+
TeX: { equationNumbers: { autoNumber: "none" } }
11+
})
12+
MathJax.Hub.Register.StartupHook("AsciiMath Jax Ready", function () {
13+
MathJax.InputJax.AsciiMath.postfilterHooks.Add(function (data, node) {
14+
if ((node = data.script.parentNode) && (node = node.parentNode) && node.classList.contains("stemblock")) {
15+
data.math.root.display = "block"
16+
}
17+
return data
18+
})
19+
})
20+
</script>
21+
<script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.9/MathJax.js?config=TeX-MML-AM_HTMLorMML"></script>
22+
{{/unless}}
23+
{{/with}}
324
{{#if env.ALGOLIA_API_KEY}}
425
<script async id="search-script" src="{{{uiRootPath}}}/js/vendor/docsearch.js"{{#if env.ALGOLIA_APP_ID}} data-app-id="{{env.ALGOLIA_APP_ID}}"{{/if}} data-api-key="{{env.ALGOLIA_API_KEY}}" data-index-name="{{env.ALGOLIA_IDX_NAME}}" data-stylesheet="{{{uiRootPath}}}/css/vendor/docsearch.css"></script>
526
{{#if page.home}}

0 commit comments

Comments
 (0)