JSPM

  • Created
  • Published
  • Downloads 7851
  • Score
    100M100P100Q134021F
  • License MIT

markdown-it extension for rendering TeX Math

Package Exports

  • markdown-it-texmath

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (markdown-it-texmath) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

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.

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.

  • Inline math by $ ... $
  • Display math by $$ ... $$
  • Add formula numbering by $$ ... $$ (1)
  • Inline math with tables, lists and blockquote.

Show me

try ...

Use with node.js

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

npm install markdown-it-texmath

Use it with JavaScript.

let tm = require('markdown-it-texmath'),
    md = require('markdown-it')().use(tm);

md.render('Euler\'s identity $e^{i\pi}+1=0$ is a beautiful formula.')

Use in Browser

<html>
<head>
  <meta charset='utf-8'>
  <link rel="stylesheet" href="github-markdown.min.css">
  <link rel="stylesheet" href="katex.min.css">
  <link rel="stylesheet" href="texmath.css">
  <script src="markdown-it.min.js"></script>
  <script src="katex.min.js"></script>
  <script src="texmath.js"></script>
</head>
<body>
  <div id="out" class="markdown-body"></div>
  <script>
    let md, kt, tm;
    document.addEventListener("DOMContentLoaded", () => {
        kt = katex;
        tm = texmath;
        md = markdownit().use(tm);
        out.innerHTML = md.render('Euler\'s identity $e^{i\pi}+1=0$ is a beautiful formula.');
  </script>
</body>
</html>

CDN

Use following links for texmath.js and texmath.css

  • https://gitcdn.xyz/cdn/goessner/markdown-it-texmath/master/texmath.js
  • https://gitcdn.xyz/cdn/goessner/markdown-it-texmath/master/texmath.css

Dependencies

  • markdown-it: Markdown parser done right. Fast and easy to extend.
  • katex: This is where credits for fast rendering TeX math in HTML go to.

ToDo

  • Allow additional math delimiters.
  • Integrate markdown-it-texmath into mdmath.

License

markdown-it-texmath is licensed under the MIT License

© Stefan Gössner