Skip to content

Commit 94fc67e

Browse files
committed
feat(mkdocs): math equations
1 parent 40fd8c5 commit 94fc67e

File tree

3 files changed

+38
-0
lines changed

3 files changed

+38
-0
lines changed

docs/javascripts/mathjax.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
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.startup.output.clearCache()
16+
MathJax.typesetClear()
17+
MathJax.texReset()
18+
MathJax.typesetPromise()
19+
})

docs/mkdocs/mkdocs.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,3 +77,15 @@ graph LR
7777
D --> B;
7878
B ---->|No| E[Yay!];
7979
```
80+
81+
### Math Equations with LaTeX syntax
82+
83+
$a^2 + b^2 = c^2$
84+
85+
$$
86+
\begin{align*}
87+
\dot{x} & = \sigma(y-x) \\
88+
\dot{y} & = \rho x - y - xz \\
89+
\dot{z} & = -\beta z + xy
90+
\end{align*}
91+
$$

mkdocs.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,3 +123,10 @@ markdown_extensions:
123123
- pymdownx.tilde # strikethrough with ~~ ~~
124124
- toc:
125125
permalink: true
126+
# MathJax
127+
- pymdownx.arithmatex:
128+
generic: true
129+
130+
extra_javascript:
131+
- javascripts/mathjax.js
132+
- https://unpkg.com/mathjax@3/es5/tex-mml-chtml.js

0 commit comments

Comments
 (0)