hexo-filter-katex
Version:
Server side Math Expression Renderer for Hexo, powered by Katex.
40 lines (33 loc) • 1.51 kB
Markdown
[![npm-image]][npm-url]
[![license-image]](LICENSE)
Server side Math Expression Renderer for Hexo, powered by [KaTeX](https://katex.org/).
```markdown
$ \frac{b^2+c^2-a^2} $
$$
\cos A = \frac{b^2+c^2-a^2}{2bc} = \frac{(b+c)^2-a^2-2bc}{2bc}
$$
```
The plugin works perfectly out of the box.
Though, you can config it to adapt to your preferences.
```yaml
katex:
render_options:
stylesheet_fragment: '<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.15.3/dist/katex.min.css" integrity="sha256-TThEtR+XalhWKkfF383YLOrI50NGNeIqrzS+q08afrY=" crossorigin="anonymous">'
```
Even when you are using a math-unaware Markdown Renderer (eg. marked), additional escaping is not necessary.
The plugin ensures that all math expressions are not interpreted as Markdown syntax.
Note that the tag `_internal_math_placeholder` will be used internally, and you need to ensure that it is not used elsewhere.
[npm-image]: https://img.shields.io/npm/v/hexo-filter-katex?style=flat-square
[license-image]: https://img.shields.io/npm/l/hexo-filter-katex?style=flat-square
[npm-url]: https://www.npmjs.com/package/hexo-filter-katex