mirror of
https://github.com/squidfunk/mkdocs-material.git
synced 2024-06-14 11:52:32 +03:00
Documentation
This commit is contained in:
@@ -46,6 +46,9 @@ to your `mkdocs.yml`.
|
|||||||
};
|
};
|
||||||
|
|
||||||
document$.subscribe(() => { // (1)!
|
document$.subscribe(() => { // (1)!
|
||||||
|
MathJax.startup.output.clearCache()
|
||||||
|
MathJax.typesetClear()
|
||||||
|
MathJax.texReset()
|
||||||
MathJax.typesetPromise()
|
MathJax.typesetPromise()
|
||||||
})
|
})
|
||||||
```
|
```
|
||||||
@@ -72,6 +75,22 @@ See additional configuration options:
|
|||||||
[Arithmatex]: ../setup/extensions/python-markdown-extensions.md#arithmatex
|
[Arithmatex]: ../setup/extensions/python-markdown-extensions.md#arithmatex
|
||||||
[instant loading]: ../setup/setting-up-navigation.md#instant-loading
|
[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
|
### KaTeX
|
||||||
|
|
||||||
@@ -105,34 +124,13 @@ supports a subset of LaTeX syntax and can render math to HTML and SVG. To use
|
|||||||
|
|
||||||
extra_javascript:
|
extra_javascript:
|
||||||
- javascripts/katex.js
|
- 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
|
- https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.16.7/contrib/auto-render.min.js
|
||||||
|
|
||||||
extra_css:
|
extra_css:
|
||||||
- https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.16.7/katex.min.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
|
## Usage
|
||||||
|
|
||||||
### Using block syntax
|
### Using block syntax
|
||||||
@@ -172,30 +170,30 @@ that $f(a)=f(b)$.
|
|||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
## Comparing MathJax and KaTeX
|
## Comparing MathJax and KaTeX
|
||||||
|
|
||||||
When deciding between MathJax and KaTeX, there are several key factors to
|
When deciding between MathJax and KaTeX, there are several key factors to
|
||||||
consider:
|
consider:
|
||||||
|
|
||||||
- __Speed__: KaTeX is generally faster than MathJax. If your site requires rendering large
|
- __Speed__: KaTeX is generally faster than MathJax. If your site requires
|
||||||
quantities of complex equations quickly, KaTeX may be the better choice.
|
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
|
- __Syntax Support__: MathJax supports a wider array of LaTeX commands and can
|
||||||
process a variety of mathematical markup languages (like AsciiMath and MathML).
|
process a variety of mathematical markup languages (like AsciiMath and MathML).
|
||||||
If you need advanced LaTeX features, MathJax may be more suitable.
|
If you need advanced LaTeX features, MathJax may be more suitable.
|
||||||
|
|
||||||
- __Output Format__: Both libraries support HTML and SVG outputs. However,
|
- __Output Format__: Both libraries support HTML and SVG outputs. However,
|
||||||
MathJax also offers MathML output, which can be essential for accessibility, as
|
MathJax also offers MathML output, which can be essential for accessibility,
|
||||||
it is readable by screen readers.
|
as it is readable by screen readers.
|
||||||
|
|
||||||
- __Configurability__: MathJax provides a range of configuration options,
|
- __Configurability__: MathJax provides a range of configuration options,
|
||||||
allowing for more precise control over its behavior. If you have specific
|
allowing for more precise control over its behavior. If you have specific
|
||||||
rendering requirements, MathJax might be a more flexible choice.
|
rendering requirements, MathJax might be a more flexible choice.
|
||||||
|
|
||||||
- __Browser Support__: While both libraries work well in modern browsers,
|
- __Browser Support__: While both libraries work well in modern browsers,
|
||||||
MathJax has broader compatibility with older browsers. If your audience uses a
|
MathJax has broader compatibility with older browsers. If your audience uses a
|
||||||
variety of browsers, including older ones, MathJax might be a safer option.
|
variety of browsers, including older ones, MathJax might be a safer option.
|
||||||
|
|
||||||
In summary, KaTeX shines with its speed and simplicity, whereas MathJax offers
|
In summary, KaTeX shines with its speed and simplicity, whereas MathJax offers
|
||||||
more features and better compatibility at the expense of speed. The choice
|
more features and better compatibility at the expense of speed. The choice
|
||||||
|
|||||||
@@ -53,11 +53,17 @@ of [additional JavaScript]:
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
document$.subscribe(() => {
|
document$.subscribe(() => { // (1)!
|
||||||
|
MathJax.startup.output.clearCache()
|
||||||
|
MathJax.typesetClear()
|
||||||
|
MathJax.texReset()
|
||||||
MathJax.typesetPromise()
|
MathJax.typesetPromise()
|
||||||
})
|
})
|
||||||
```
|
```
|
||||||
|
|
||||||
|
1. This integrates MathJax with [instant loading]
|
||||||
|
|
||||||
|
|
||||||
=== ":octicons-file-code-16: `mkdocs.yml`"
|
=== ":octicons-file-code-16: `mkdocs.yml`"
|
||||||
|
|
||||||
``` yaml
|
``` yaml
|
||||||
@@ -81,6 +87,7 @@ See reference for usage:
|
|||||||
[MathJax]: https://www.mathjax.org/
|
[MathJax]: https://www.mathjax.org/
|
||||||
[KaTeX]: https://github.com/Khan/KaTeX
|
[KaTeX]: https://github.com/Khan/KaTeX
|
||||||
[additional JavaScript]: ../../customization.md#additional-javascript
|
[additional JavaScript]: ../../customization.md#additional-javascript
|
||||||
|
[instant loading]: ../setting-up-navigation.md#instant-loading
|
||||||
[Using block syntax]: ../../reference/math.md#using-block-syntax
|
[Using block syntax]: ../../reference/math.md#using-block-syntax
|
||||||
[Using inline block syntax]: ../../reference/math.md#using-inline-block-syntax
|
[Using inline block syntax]: ../../reference/math.md#using-inline-block-syntax
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user