mirror of
https://github.com/squidfunk/mkdocs-material.git
synced 2024-06-14 11:52:32 +03:00
Documentation
This commit is contained in:
parent
e8504fdffb
commit
14d7874d0d
@ -46,6 +46,9 @@ to your `mkdocs.yml`.
|
||||
};
|
||||
|
||||
document$.subscribe(() => { // (1)!
|
||||
MathJax.startup.output.clearCache()
|
||||
MathJax.typesetClear()
|
||||
MathJax.texReset()
|
||||
MathJax.typesetPromise()
|
||||
})
|
||||
```
|
||||
@ -72,6 +75,22 @@ See additional configuration options:
|
||||
[Arithmatex]: ../setup/extensions/python-markdown-extensions.md#arithmatex
|
||||
[instant loading]: ../setup/setting-up-navigation.md#instant-loading
|
||||
|
||||
<script src="https://polyfill.io/v3/polyfill.min.js?features=es6"></script>
|
||||
<script id="MathJax-script" async src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js"></script>
|
||||
<script>
|
||||
window.MathJax = {
|
||||
tex: {
|
||||
inlineMath: [["\\(", "\\)"]],
|
||||
displayMath: [["\\[", "\\]"]],
|
||||
processEscapes: true,
|
||||
processEnvironments: true
|
||||
},
|
||||
options: {
|
||||
ignoreHtmlClass: ".*|",
|
||||
processHtmlClass: "arithmatex"
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
### KaTeX
|
||||
|
||||
@ -105,34 +124,13 @@ supports a subset of LaTeX syntax and can render math to HTML and SVG. To use
|
||||
|
||||
extra_javascript:
|
||||
- javascripts/katex.js
|
||||
- https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.16.7/katex.min.js # (1)!
|
||||
- https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.16.7/katex.min.js
|
||||
- https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.16.7/contrib/auto-render.min.js
|
||||
|
||||
extra_css:
|
||||
- https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.16.7/katex.min.css
|
||||
```
|
||||
|
||||
1. Alternatively, you can add these JavaScript and CSS files via `script` tags by overriding HTML files.
|
||||
|
||||
|
||||
<script src="https://polyfill.io/v3/polyfill.min.js?features=es6"></script>
|
||||
<script id="MathJax-script" async src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js"></script>
|
||||
<script>
|
||||
window.MathJax = {
|
||||
tex: {
|
||||
inlineMath: [["\\(", "\\)"]],
|
||||
displayMath: [["\\[", "\\]"]],
|
||||
processEscapes: true,
|
||||
processEnvironments: true
|
||||
},
|
||||
options: {
|
||||
ignoreHtmlClass: ".*|",
|
||||
processHtmlClass: "arithmatex"
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
### Using block syntax
|
||||
@ -172,22 +170,22 @@ that $f(a)=f(b)$.
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
## Comparing MathJax and KaTeX
|
||||
|
||||
When deciding between MathJax and KaTeX, there are several key factors to
|
||||
consider:
|
||||
|
||||
- __Speed__: KaTeX is generally faster than MathJax. If your site requires rendering large
|
||||
quantities of complex equations quickly, KaTeX may be the better choice.
|
||||
- __Speed__: KaTeX is generally faster than MathJax. If your site requires
|
||||
rendering large quantities of complex equations quickly, KaTeX may be the
|
||||
better choice.
|
||||
|
||||
- __Syntax Support__: MathJax supports a wider array of LaTeX commands and can
|
||||
process a variety of mathematical markup languages (like AsciiMath and MathML).
|
||||
If you need advanced LaTeX features, MathJax may be more suitable.
|
||||
|
||||
- __Output Format__: Both libraries support HTML and SVG outputs. However,
|
||||
MathJax also offers MathML output, which can be essential for accessibility, as
|
||||
it is readable by screen readers.
|
||||
MathJax also offers MathML output, which can be essential for accessibility,
|
||||
as it is readable by screen readers.
|
||||
|
||||
- __Configurability__: MathJax provides a range of configuration options,
|
||||
allowing for more precise control over its behavior. If you have specific
|
||||
|
@ -53,11 +53,17 @@ of [additional JavaScript]:
|
||||
}
|
||||
};
|
||||
|
||||
document$.subscribe(() => {
|
||||
document$.subscribe(() => { // (1)!
|
||||
MathJax.startup.output.clearCache()
|
||||
MathJax.typesetClear()
|
||||
MathJax.texReset()
|
||||
MathJax.typesetPromise()
|
||||
})
|
||||
```
|
||||
|
||||
1. This integrates MathJax with [instant loading]
|
||||
|
||||
|
||||
=== ":octicons-file-code-16: `mkdocs.yml`"
|
||||
|
||||
``` yaml
|
||||
@ -81,6 +87,7 @@ See reference for usage:
|
||||
[MathJax]: https://www.mathjax.org/
|
||||
[KaTeX]: https://github.com/Khan/KaTeX
|
||||
[additional JavaScript]: ../../customization.md#additional-javascript
|
||||
[instant loading]: ../setting-up-navigation.md#instant-loading
|
||||
[Using block syntax]: ../../reference/math.md#using-block-syntax
|
||||
[Using inline block syntax]: ../../reference/math.md#using-inline-block-syntax
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user