rehype-asciimath
To 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
Example markdown
Wrap your code in backticks (`) inside the dollars ($) for rendering the block using ASCIIMath
ASCIIMath Inline (Use rehype-asciimath
To be used in conjunction with Katex or MathJAX
This uses the __INLINE_CODE_0__ from the ASCIIMath repo with a patch which is yet to be merged
Example markdown
Wrap your code in backticks (__INLINE_CODE_1__) inside the dollars (__INLINE_CODE_2__) for rendering the block using ASCIIMath
...`$), e.g. rehype-asciimath
To be used in conjunction with Katex or MathJAX
This uses the __INLINE_CODE_0__ from the ASCIIMath repo with a patch which is yet to be merged
Example markdown
Wrap your code in backticks (__INLINE_CODE_1__) inside the dollars (__INLINE_CODE_2__) for rendering the block using ASCIIMath
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. rehype-asciimath
To be used in conjunction with Katex or MathJAX
This uses the __INLINE_CODE_0__ from the ASCIIMath repo with a patch which is yet to be merged
Example markdown
Wrap your code in backticks (__INLINE_CODE_1__) inside the dollars (__INLINE_CODE_2__) for rendering the block using ASCIIMath
sqrt(x)`{}$
$
{}`x / (y+z) = \frac{a}{b+c}`
$
Renders as:

Usage
- Add this plugin to your dependencies
npm i -s rehype-asciimath - Add the
remark-mathandrehype-katex(or rehype-mathjax) plugins to your dependencies - Use the
rehype-asciimathplugin before therehype-katexplugin - Example config
const remarkMath = require("remark-math");
const rehypeASCIIMath = require("rehype-asciimath");
const rehypeKatex = require("rehype-katex");
const config = {
remarkPlugins: [remarkMath],
rehypePlugins: [
rehypeAsciiMath,
rehypeKatex,
]
}
License
The MIT License https://meghprkh.mit-license.org/
Copyright 2020 Megh Parikh meghprkh@gmail.com