Skip to content

Commit c1948b2

Browse files
committed
moved katex documentation to math.md
1 parent 3bd214f commit c1948b2

File tree

3 files changed

+37
-75
lines changed

3 files changed

+37
-75
lines changed

docs/reference/katex.md

-70
This file was deleted.

docs/reference/mathjax.md renamed to docs/reference/math.md

+36-3
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,14 @@ icon: material/alphabet-greek
66

77
[MathJax] is a beautiful and accessible way to display mathematical content
88
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
1010
Material for MkDocs.
1111

1212
[MathJax]: https://www.mathjax.org/
1313
[LaTeX]: https://en.wikibooks.org/wiki/LaTeX/Mathematics
1414
[MathML]: https://en.wikipedia.org/wiki/MathML
1515
[AsciiMath]: http://asciimath.org/
16+
[KaTeX]: https://katex.org/
1617

1718
## Configuration
1819

@@ -43,19 +44,51 @@ lines to `mkdocs.yml`:
4344

4445
1. This integrates MathJax with [instant loading].
4546

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"
4765

4866
``` yaml
4967
markdown_extensions:
5068
- pymdownx.arithmatex:
5169
generic: true
5270

5371
extra_javascript:
54-
- javascripts/mathjax.js
72+
- javascripts/mathjax.js
5573
- https://polyfill.io/v3/polyfill.min.js?features=es6
5674
- https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js
5775
```
5876

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+
5992
See additional configuration options:
6093

6194
- [Arithmatex]

mkdocs.yml

+1-2
Original file line numberDiff line numberDiff line change
@@ -219,8 +219,7 @@ nav:
219219
- Icons, Emojis: reference/icons-emojis.md
220220
- Images: reference/images.md
221221
- Lists: reference/lists.md
222-
- MathJax: reference/mathjax.md
223-
- KaTeX: reference/katex.md
222+
- Math: reference/math.md
224223
- Tooltips: reference/tooltips.md
225224
- Insiders:
226225
- insiders/index.md

0 commit comments

Comments
 (0)