README
markdown-it-katexx
Add Math to your Markdown
KaTeX is a faster alternative to MathJax. This plugin makes it easy to support your markdown.
Need convincing?
- Check out the comparative benchmark: KaTeX vs MathJax
- Try it in your browser: markdown-it-katex demo
TODO
- Switch to Jest
- Typescript
- Set up CI/CD
- Publish NPM package
- Bundler
- precommit hooks
- Code improvements?
- More test coverage?
Usage
Install it and add it to your config (Vuepress):
module.exports = {
head: [
[
'link',
{
rel: 'stylesheet',
href: 'https://cdn.jsdelivr.net/npm/katex@0.11.1/dist/katex.min.css',
},
],
],
markdown: {
extendMarkdown: md => {
md.set({ breaks: true });
md.use(require('markdown-it-katexx'), { throwOnError: false, errorColor: ' #cc0000' });
},
},
};
Getting Started
Install markdown-it
npm install markdown-it
Install the plugin
npm install markdown-it-katexx
Use it in your javascript:
var md = require('markdown-it')(),
mk = require('markdown-it-katexx');
md.use(mk);
// double backslash is required for javascript strings, but not html input
var result = md.render('# Math Rulez! \n $\\sqrt{3x-1}+(1+x)^2