npm.io
1.0.0 • Published 5 years ago

rehype-asciimath

Licence
MIT
Version
1.0.0
Deps
3
Size
51 kB
Vulns
0
Weekly
0

rehype-asciimath

ASCIIMath plugin for Rehype

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

ASCIIMath plugin for Rehype

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

ASCIIMath plugin for Rehype

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

ASCIIMath plugin for Rehype

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:

example_output

Usage

  • Add this plugin to your dependencies npm i -s rehype-asciimath
  • Add the remark-math and rehype-katex (or rehype-mathjax) plugins to your dependencies
  • Use the rehype-asciimath plugin before the rehype-katex plugin
  • 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

Keywords