Home

Awesome

License npm npm

markdown-it-texmath

Add TeX math equations to your Markdown documents rendered by markdown-it parser. KaTeX is used as a fast math renderer.

What's New?

Features

Simplify the process of authoring markdown documents containing math formulas. This extension is a comfortable tool for scientists, engineers and students with markdown as their first choice document format.

Show me

View a test table.

try it out ...

Use with node.js

Install the extension. Verify having markdown-it and katex already installed .

npm install markdown-it-texmath

Use it with JavaScript.

const tm = require('markdown-it-texmath');
const md = require('markdown-it')({html:true})
                  .use(tm, { engine: require('katex'),
                             delimiters: 'dollars',
                             katexOptions: { macros: {"\\RR": "\\mathbb{R}"} } });
const str = "Euler\'s identity $e^{i\\pi}+1=0$ is a beautiful formula in $\\RR^2$.";

md.render(str);

Use in Browser

<!doctype html>
<html>
<head>
  <meta charset='utf-8'>
  <link  rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex/dist/katex.min.css">
  <link rel="stylesheet" href="../css/texmath.css">
  <script src="https://cdn.jsdelivr.net/npm/markdown-it/dist/markdown-it.min.js"></script>
  <script src="https://cdn.jsdelivr.net/npm/katex/dist/katex.min.js"></script>
  <script src="../texmath.js"></script>
  <title>test</title>
</head>
<body>
  <div id="out"></div>
  <script>
    const str = `"Euler\'s identity $e^{i\\pi}+1=0$ is a beautiful formula in $\\RR^2$."`
    document.addEventListener("DOMContentLoaded", () => {
        const md = markdownit({html:true})
                      .use(texmath, { engine: katex,
                                      delimiters: 'dollars',
                                      katexOptions: { macros: {"\\RR": "\\mathbb{R}"} } } );
        out.innerHTML = md.render(str);
    })
  </script>
</body>
</html>

CDN

Use following links for texmath.js and texmath.css

Dependencies

ToDo

nothing yet

FAQ

CHANGELOG

[1.0.0] on May 28, 2022

[0.9.7] on December 07, 2021

[0.9.6] on November 16, 2021

[0.9.5] on November 12, 2021

[0.9.4] on November 12, 2021

[0.9.3] on October 28, 2021

[0.9.2] on October 27, 2021

[0.9.1] on July 02, 2021

[0.9.0] on May 26, 2021

[0.8.0] on July 10, 2020

[0.7.2] on June 22, 2020

[0.7.0] on June 14, 2020

[0.6.9] on June 11, 2020

[0.6.7] on April 29, 2020

[0.6.6] on April 07, 2020

[0.6.5] on April 05, 2020

[0.6.0] on October 04, 2019

[0.5.5] on February 07, 2019

[0.5.4] on January 20, 2019

[0.5.3] on November 11, 2018

[0.5.2] on September 07, 2018

[0.5.0] on August 15, 2018

[0.4.6] on January 05, 2018

[0.4.5] on November 06, 2017

[0.4.4] on September 27, 2017

License

markdown-it-texmath is licensed under the MIT License

© Stefan Gössner