https://github.com/lierdakil/mathjax-pandoc-filter
Nodejs implementation of pandoc filter to turn TeX math into embedded SVG
https://github.com/lierdakil/mathjax-pandoc-filter
Last synced: 3 months ago
JSON representation
Nodejs implementation of pandoc filter to turn TeX math into embedded SVG
- Host: GitHub
- URL: https://github.com/lierdakil/mathjax-pandoc-filter
- Owner: lierdakil
- License: mit
- Created: 2015-02-08T23:26:22.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2022-12-07T19:41:12.000Z (over 2 years ago)
- Last Synced: 2025-03-14T16:41:56.143Z (3 months ago)
- Language: TypeScript
- Size: 55.7 KB
- Stars: 22
- Watchers: 2
- Forks: 6
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE.md
Awesome Lists containing this project
README
# mathjax-pandoc-filter
Install via `npm i mathjax-pandoc-filter`
Example usage:
```bash
echo '$$a_i$$' | pandoc --filter ~/node_modules/.bin/mathjax-pandoc-filter
```Or, if you have npm bin in PATH, just
```bash
echo '$$a_i$$' | pandoc --filter mathjax-pandoc-filter
```## Configuration
The filter will check Pandoc metadata for the following boolean options:
- `mathjax.centerDisplayMath`
Will add `text-align: center` style to display math paragraphs
- `mathjax.noInlineSVG`
Will render math as `img` tags instead of inline `svg`
- `mathjax`
Will be converted to JS object and passed to `MathJax.config`. Refer to
[MathJax-node documentation](https://github.com/mathjax/MathJax-node#configoptions) for details.- `mathjax.typeset`
Will be unified with default typeset options and passed to each call of `MathJax.typeset`. Refer to [MathJax-node documentation](https://github.com/mathjax/MathJax-node#typesetoptions-callback) for details.
Values here will override the defaults.
Note: you can override any values, but you probably don't want to touch `math` and `svg` at least.
Example:
```bash
echo '$$a_i$$' | pandoc --filter mathjax-pandoc-filter -Mmathjax.centerDisplayMath -Mmathjax.noInlineSVG
```You can also specify this options in Markdown document's YAML header:
```markdown
---
mathjax.centerDisplayMath: true
mathjax.noInlineSVG: true
mathjax.typeset:
cjkCharWidth: 15
---$$a_i$$
```Note: you can't set `mathjax` or `mathjax.typeset` from command line.