Created
July 10, 2024 18:39
-
-
Save mathwo/4958a7e50be85743615c18d9e34109e9 to your computer and use it in GitHub Desktop.
How to add MathJax support to Zola Static Site Generator
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Step 1: follow the instructions on this [starting guide](https://www.getzola.org/documentation/getting-started/overview/) | |
| Step 2: add following piece of code in templates/blog-page.html (before the last line): | |
| ``` | |
| {% if page.extra.math %} | |
| <script> | |
| MathJax = { | |
| tex: { | |
| inlineMath: [['$', '$'], ['\\(', '\\)']] | |
| } | |
| }; | |
| </script> | |
| <script type="text/javascript" async | |
| src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-chtml.js"> | |
| </script> | |
| {% endif %} | |
| ``` | |
| Step 3: In the head of each post markdown file, add two lines: | |
| ``` | |
| [extra] | |
| math = true | |
| ``` | |
| Then you can use MathJax latex expressions in the markdown posts. | |
| Note: Single $ for inline math, $$ for block math, \newline for new line break. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment