![]() |
2 月之前 | |
---|---|---|
.. | ||
__pycache__ | 2 月之前 | |
LICENSE | 2 月之前 | |
README.md | 2 月之前 | |
__init__.py | 2 月之前 | |
index.py | 2 月之前 | |
port.yaml | 2 月之前 |
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)$...$
$$...$$
$$...$$ (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.
let kt = require('katex'),
tm = require('markdown-it-texmath').use(kt),
md = require('markdown-it')().use(tm,{delimiters:'dollars',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="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"></div>
<script>
let md;
document.addEventListener("DOMContentLoaded", () => {
const tm = texmath.use(katex);
md = markdownit().use(tm,{delimiters:'dollars',macros:{"\\RR": "\\mathbb{R}"}});
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://gitcdn.xyz/cdn/goessner/markdown-it-texmath/master/texmath.js
https://gitcdn.xyz/cdn/goessner/markdown-it-texmath/master/texmath.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
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
).block
mode regular expression with gitlab
delimiters, so removing the newline
bug.markdown-it-texmath
is licensed under the MIT License