A rehype plugin for ASCIIMath
npm install rehype-asciimathTo be used in conjunction with Katex or MathJAX
This uses the ASCIIMathTeXImg.js from the ASCIIMath repo with a patch which is yet to be merged
Wrap your code in backticks (` `) inside the dollars ($) for rendering the block using ASCIIMath
`plain...
ASCIIMath Inline (Use $$), e.g. $sqrt(x)$
ASCIIMath Block (Use $$...$$), e.g.
$$
x / (y+z) = \frac{a}{b+c}
$$
LaTeX inside ASCIIMath should stay as it is
Normal math (without backticks) will render as it is $sqrt(x)$ (LaTeX but no ASCIIMath)
To not parse it as ASCIIMath and still use backticks (at the start or the end), start or end your LaTeX code with empty braces ({}), e.g. $sqrt(x){}$
$$
{}x / (y+z) = \frac{a}{b+c}`
$$
Renders as:
- Add this plugin to your dependencies npm i -s rehype-asciimathremark-math
- Add the and rehype-katex (or rehype-mathjax) plugins to your dependenciesrehype-asciimath
- Use the plugin before the rehype-katex plugin
- Example config
`js
const remarkMath = require("remark-math");
const rehypeASCIIMath = require("rehype-asciimath");
const rehypeKatex = require("rehype-katex");
const config = {
remarkPlugins: [remarkMath],
rehypePlugins: [
rehypeAsciiMath,
rehypeKatex,
]
}
``
The MIT License https://meghprkh.mit-license.org/
Copyright © 2020 Megh Parikh meghprkh@gmail.com