@@ -6,13 +6,14 @@ icon: material/alphabet-greek
6
6
7
7
[ MathJax] is a beautiful and accessible way to display mathematical content
8
8
in the browser, adds support for mathematical typesetting in different notations
9
- (e.g. [ LaTeX] , [ MathML] , [ AsciiMath] ), and can be easily integrated with
9
+ (e.g. [ LaTeX] , [ MathML] , [ AsciiMath] , [ KaTeX ] ), and can be easily integrated with
10
10
Material for MkDocs.
11
11
12
12
[ MathJax ] : https://www.mathjax.org/
13
13
[ LaTeX ] : https://en.wikibooks.org/wiki/LaTeX/Mathematics
14
14
[ MathML ] : https://en.wikipedia.org/wiki/MathML
15
15
[ AsciiMath ] : http://asciimath.org/
16
+ [ KaTeX ] : https://katex.org/
16
17
17
18
## Configuration
18
19
@@ -43,19 +44,51 @@ lines to `mkdocs.yml`:
43
44
44
45
1. This integrates MathJax with [instant loading].
45
46
46
- === ":octicons-file-code-16: ` mkdocs.yml ` "
47
+ === ":octicons-file-code-16: ` docs/javascripts/katex.js ` "
48
+
49
+ ``` js
50
+ document$.subscribe(() => { // (1)!
51
+ renderMathInElement(document.body, {
52
+ delimiters: [
53
+ {left: '$$', right: '$$', display: true},
54
+ {left: '$', right: '$', display: false},
55
+ {left: '\\(', right: '\\)', display: false},
56
+ {left: '\\[', right: '\\]', display: true},
57
+ ],
58
+ });
59
+ })
60
+ ```
61
+
62
+ 1. This integrates KaTeX with [instant loading].
63
+
64
+ === ":octicons-file-code-16: ` mkdocs.yml ` for MathJax"
47
65
48
66
``` yaml
49
67
markdown_extensions:
50
68
- pymdownx.arithmatex:
51
69
generic: true
52
70
53
71
extra_javascript:
54
- - javascripts/mathjax.js
72
+ - javascripts/mathjax.js
55
73
- https://polyfill.io/v3/polyfill.min.js?features=es6
56
74
- https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js
57
75
```
58
76
77
+ === ":octicons-file-code-16: ` mkdocs.yml ` for KaTeX"
78
+
79
+ ``` yaml
80
+ extra_javascript:
81
+ - javascripts/katex.js
82
+ - https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.16.7/katex.min.js # (1)!
83
+ - https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.16.7/contrib/auto-render.min.js
84
+
85
+ extra_css:
86
+ - https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.16.7/katex.min.css
87
+ ```
88
+
89
+ 1. Or you can adgitd these JS/CSS via `<script>` tag by overriding HTML files.
90
+
91
+
59
92
See additional configuration options:
60
93
61
94
- [ Arithmatex]
0 commit comments