Skip to content

Commit 96aa6b8

Browse files
docs(mkdocs): enable instant loading of mathjax equations (autowarefoundation#3846)
* fix(docs): fixed rendering error mathjax Signed-off-by: Mamoru Sobue <mamoru.sobue@tier4.jp> * add js/mathjax.js to render equation with instant loading Signed-off-by: Mamoru Sobue <mamoru.sobue@tier4.jp> * enable instant loading Signed-off-by: Mamoru Sobue <mamoru.sobue@tier4.jp> * style(pre-commit): autofix * add js/mathjax.js to sync file setting Signed-off-by: Mamoru Sobue <mamoru.sobue@tier4.jp> --------- Signed-off-by: Mamoru Sobue <mamoru.sobue@tier4.jp> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent 42d147b commit 96aa6b8

File tree

3 files changed

+22
-2
lines changed

3 files changed

+22
-2
lines changed

.github/sync-files.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -97,3 +97,4 @@
9797
sd "/edit/main/docs/" "/edit/main/" {source}
9898
sd "docs_dir: .*" "docs_dir: ." {source}
9999
sd "assets/(\w+)" "docs/assets/\$1" {source}
100+
- source: docs/assets/js/mathjax.js

docs/assets/js/mathjax.js

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
window.MathJax = {
2+
tex: {
3+
inlineMath: [["\\(", "\\)"]],
4+
displayMath: [["\\[", "\\]"]],
5+
processEscapes: true,
6+
processEnvironments: true,
7+
},
8+
options: {
9+
ignoreHtmlClass: ".*|",
10+
processHtmlClass: "arithmatex",
11+
},
12+
};
13+
14+
document$.subscribe(() => {
15+
MathJax.typesetPromise();
16+
});

mkdocs.yaml

+5-2
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,9 @@ extra_css:
4545
- https://use.fontawesome.com/releases/v5.15.4/css/all.css
4646

4747
extra_javascript:
48-
- https://cdn.jsdelivr.net/npm/mathjax@2/MathJax.js?config=TeX-AMS-MML_HTMLorMML
48+
- docs/assets/js/mathjax.js
49+
- https://polyfill.io/v3/polyfill.min.js?features=es6
50+
- https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js
4951

5052
plugins:
5153
- awesome-pages
@@ -73,7 +75,8 @@ markdown_extensions:
7375
- plantuml_markdown:
7476
server: http://www.plantuml.com/plantuml
7577
format: svg
76-
- pymdownx.arithmatex
78+
- pymdownx.arithmatex:
79+
generic: true
7780
- pymdownx.details
7881
- pymdownx.emoji:
7982
emoji_index: !!python/name:materialx.emoji.twemoji

0 commit comments

Comments
 (0)