
Product
Announcing Socket Fix 2.0
Socket Fix 2.0 brings targeted CVE remediation, smarter upgrade planning, and broader ecosystem support to help developers get to zero alerts.
@catnose99/markdown-it-texmath
Advanced tools
Add TeX math equations to your Markdown documents rendered by markdown-it parser. KaTeX is used as a fast math renderer.
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.
'dollars'
(default)
$...$
or $$...$$
$$...$$
$$...$$ (1)
'brackets'
\(...\)
\[...\]
\[...\] (1)
'gitlab'
$`...`$
```math ... ```
```math ... ``` (1)
'julia'
$...$
or ``...``
```math ... ```
```math ... ``` (1)
'kramdown'
$$...$$
$$...$$
$$...$$ (1)
View a test table.
node.js
Install the extension. Verify having markdown-it
and katex
already installed .
npm install markdown-it-texmath
Use it with JavaScript.
tm = require('markdown-it-texmath'),
md = require('markdown-it')().use(tm, { engine: require('katex'),
delimiters:'dollars',
katexOptions: { macros: {"\\RR": "\\mathbb{R}"} }
});
md.render('Euler\'s identity \(e^{i\pi}+1=0\) is a beautiful formula in $\\RR 2$.')
<html>
<head>
<meta charset='utf-8'>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex/dist/katex.min.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/markdown-it-texmath/css/texmath.min.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="https://cdn.jsdelivr.net/npm/markdown-it-texmath/texmath.min.js"></script>
</head>
<body>
<div id="out"></div>
<script>
document.addEventListener("DOMContentLoaded", () => {
const tm = texmath.use(katex);
const md = markdownit().use(tm, { engine: katex,
delimiters:'dollars',
katexOptions: { macros: {"\\RR": "\\mathbb{R}"} }
});
document.getElementById('out').innerHTML =
md.render('Euler\'s identity $e^{i\pi}+1=0$ is a beautiful formula in //RR 2.');
})
</script>
</body>
</html>
Use following links for texmath.js
and texmath.css
https://cdn.jsdelivr.net/npm/markdown-it-texmath/texmath.min.js
https://cdn.jsdelivr.net/npm/markdown-it-texmath/css/texmath.min.css
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.nothing yet
Support of inline syntax of display math ?
dollars
mode is supported starting from version "0.7.0". So 'This formula $$a+b=c$$ will result in display math presentation'
, i.e. gets displayed on a separate line. For true inline math use $..$
mode like before.Multiline diplay math in blockquote
block possible ?
blockquote
blocks is able to span multiple lines with version "0.7.3".markdown-it-texmath
with React Native does not work, why ?
markdown-it-texmath
is using regular expressions with y
(sticky) property and cannot avoid this. The use of the y
flag in regular expressions means the plugin is not compatible with React Native (which as of now doesn't support it and throws an error Invalid flags supplied to RegExp constructor
).Why doesn't markdown-it-texmath
work with other engines ?
markdown-it-texmath
is a personal project of mine. As it does very well with KaTeX what I want it to do, I offer it to the public as an open source plugin. I do not have time or interest to integrate other math engines.
But if someone wants to help here out, pull requests are always welcome.gitlab
mode and display math inside blockquote
section removed.gitlab
mode removed.pandoc
mode removed. Enhanced dollars
mode now does, what pandoc
mode was requiring.dollars
mode inline math expression $$..$$
will result in display math presentation now. Adding equation numbers $$..$$(1)
is not supported in inline syntax.blockquote
blocks removed.blockquote
blocks can span multiple lines, provided that every line starts with a >
character.markdown-it
version 11.0.0katex
over to markdown-it-texmath
using options.engine
object. Works with node.js
and browsers. With node.js
options.engine
entry { engine:'katex' }
as a string also works.use
method of markdown-it-texmath
is deprecated now.block
mode regular expression with gitlab
delimiters, so removing the newline
bug.markdown-it-texmath
is licensed under the MIT License
FAQs
markdown-it extension for rendering TeX Math
We found that @catnose99/markdown-it-texmath demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Socket Fix 2.0 brings targeted CVE remediation, smarter upgrade planning, and broader ecosystem support to help developers get to zero alerts.
Security News
Socket CEO Feross Aboukhadijeh joins Risky Business Weekly to unpack recent npm phishing attacks, their limited impact, and the risks if attackers get smarter.
Product
Socket’s new Tier 1 Reachability filters out up to 80% of irrelevant CVEs, so security teams can focus on the vulnerabilities that matter.