1
0
mirror of https://github.com/squidfunk/mkdocs-material.git synced 2024-11-24 15:40:15 +01:00

Removed automatic MathJax inclusion

This commit is contained in:
squidfunk 2017-01-09 21:41:30 +01:00
parent 660844cb3c
commit 82b8c71059
5 changed files with 51 additions and 26 deletions

View File

@ -29,7 +29,8 @@ touch docs/stylesheets/extra.css
Then, add the following line to your `mkdocs.yml`: Then, add the following line to your `mkdocs.yml`:
``` yaml ``` yaml
extra_css: ['stylesheets/extra.css'] extra_css:
- 'stylesheets/extra.css'
``` ```
Spin up the development server with `mkdocs serve` and start typing your Spin up the development server with `mkdocs serve` and start typing your
@ -50,7 +51,8 @@ touch docs/javascripts/extra.js
Then, add the following line to your `mkdocs.yml`: Then, add the following line to your `mkdocs.yml`:
``` yaml ``` yaml
extra_javascript: ['javascripts/extra.js'] extra_javascript:
- 'javascripts/extra.js'
``` ```
Further assistance can be found in the [MkDocs documentation][2]. Further assistance can be found in the [MkDocs documentation][2].

View File

@ -20,6 +20,7 @@ package are recommended to be used together with the Material theme:
``` yaml ``` yaml
markdown_extensions: markdown_extensions:
- pymdownx.arithmatex
- pymdownx.betterem(smart_enable=all) - pymdownx.betterem(smart_enable=all)
- pymdownx.caret - pymdownx.caret
- pymdownx.critic - pymdownx.critic
@ -167,20 +168,57 @@ combined in {~~one~>a single~~} operation. {==Highlighting==} is also possible
[15]: https://facelessuser.github.io/pymdown-extensions/extensions/critic/ [15]: https://facelessuser.github.io/pymdown-extensions/extensions/critic/
[16]: http://criticmarkup.com/ [16]: http://criticmarkup.com/
### Math and code highlighting ### Arithmatex <small>MathJax</small>
#### Arithmatex <script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"></script>
[Arithmatex][17] integrates Material with [MathJax][18] which parses [Arithmatex][17] integrates Material with [MathJax][18] which parses
block-style and inline equations written in TeX markup and outputs them in block-style and inline equations written in TeX markup and outputs them in
mathematical notation. See [this thread][19] for a short introduction and quick mathematical notation. See [this thread][19] for a short introduction and quick
reference on how to write equations in TeX syntax. reference on how to write equations in TeX syntax.
Besides activating the extension in the `mkdocs.yml`, the MathJax JavaScript
runtime needs to be included. This can be done with
[additional JavaScript][20]:
``` yaml
extra_js:
- 'https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML'
```
If you want to override the default MathJax configuration, you can do this by
adding another JavaScript file **before** the MathJax runtime in `extra_js`
which contains your MathJax configuration, e.g.:
``` js
MathJax.Hub.Config({
config: ["MMLorHTML.js"],
extensions: ["tex2jax.js"],
jax: ["input/TeX"],
tex2jax: {
inlineMath: [ ["\\(","\\)"] ],
displayMath: [ ["\\[","\\]"] ]
},
TeX: {
TagSide: "right",
TagIndent: ".8em",
MultLineWidth: "85%",
equationNumbers: {
autoNumber: "AMS",
}
},
displayAlign: 'left',
showProcessingMessages: false,
messageStyle: 'none'
});
```
[17]: https://facelessuser.github.io/pymdown-extensions/extensions/arithmatex/ [17]: https://facelessuser.github.io/pymdown-extensions/extensions/arithmatex/
[18]: https://www.mathjax.org/ [18]: https://www.mathjax.org/
[19]: http://meta.math.stackexchange.com/questions/5020/ [19]: http://meta.math.stackexchange.com/questions/5020/
[20]: ../customization.md#additional-javascript
##### Blocks #### Blocks
Blocks are enclosed in `:::tex $$...$$` which are placed on separate lines. Blocks are enclosed in `:::tex $$...$$` which are placed on separate lines.
@ -198,7 +236,7 @@ $$
\frac{n!}{k!(n-k)!} = \binom{n}{k} \frac{n!}{k!(n-k)!} = \binom{n}{k}
$$ $$
##### Inline #### Inline
Inline equations need to be enclosed in `:::tex $...$`: Inline equations need to be enclosed in `:::tex $...$`:
@ -212,11 +250,11 @@ Result:
Lorem ipsum dolor sit amet: $p(x|y) = \frac{p(y|x)p(x)}{p(y)}$ Lorem ipsum dolor sit amet: $p(x|y) = \frac{p(y|x)p(x)}{p(y)}$
#### Inlinehilite ### InlineHilite
[Inlinehilite][20] adds support for inline code highlighting. It's useful for [InlineHilite][21] adds support for inline code highlighting. It's useful for
short snippets included within body copy, e.g. `#!js var test = 0;` and can be short snippets included within body copy, e.g. `#!js var test = 0;` and can be
achived by prefixing inline code with a shebang and language identifier, achived by prefixing inline code with a shebang and language identifier,
e.g. `#!js`. e.g. `#!js`.
[20]: https://facelessuser.github.io/pymdown-extensions/extensions/inlinehilite/ [21]: https://facelessuser.github.io/pymdown-extensions/extensions/inlinehilite/

View File

@ -105,12 +105,6 @@
{% endblock %} {% endblock %}
</div> </div>
{% block scripts %} {% block scripts %}
{% for extension in config.markdown_extensions %}
{% if extension == "pymdownx.arithmatex" %}
{% set path = "mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML" %}
<script src="https://cdn.mathjax.org/{{ path }}"></script>
{% endif %}
{% endfor %}
<script src="{{ base_url }}/assets/javascripts/application-ca9b3745c3.js"></script> <script src="{{ base_url }}/assets/javascripts/application-ca9b3745c3.js"></script>
<script>var config={url:{base:"{{ base_url }}"}},app=new Application(config);app.initialize()</script> <script>var config={url:{base:"{{ base_url }}"}},app=new Application(config);app.initialize()</script>
{% for path in extra_javascript %} {% for path in extra_javascript %}

View File

@ -82,5 +82,6 @@ pages:
- PyMdown: extensions/pymdown.md - PyMdown: extensions/pymdown.md
- Specimen: specimen.md - Specimen: specimen.md
- Customization: customization.md - Customization: customization.md
- Release notes: release-notes.md
- Contributing: contributing.md - Contributing: contributing.md
- License: license.md - License: license.md

View File

@ -203,18 +203,8 @@
{% endblock %} {% endblock %}
</div> </div>
<!-- Block: extension- and theme-related JavaScript --> <!-- Block: theme-related JavaScript -->
{% block scripts %} {% block scripts %}
{% for extension in config.markdown_extensions %}
<!-- MathJax integration -->
{% if extension == "pymdownx.arithmatex" %}
{% set path = "mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML" %}
<script src="https://cdn.mathjax.org/{{ path }}"></script>
{% endif %}
{% endfor %}
<!-- Theme-related and custom JavaScript -->
<script src="{{ base_url }}/assets/javascripts/application.js"></script> <script src="{{ base_url }}/assets/javascripts/application.js"></script>
<script> <script>