1 | # markdown-it-katex
|
2 |
|
3 | Add Math to your Markdown
|
4 |
|
5 | KaTeX is fast. This plugin makes it easy to support it in your markdown.
|
6 |
|
7 | ## Usage
|
8 |
|
9 | ```
|
10 | npm install markdown-it-katex
|
11 | ```
|
12 |
|
13 | Include the KaTeX stylesheet in your html:
|
14 | ```html
|
15 | <link rel="stylesheet"href="//cdnjs.cloudflare.com/ajax/libs/KaTeX/0.3.0/katex.min.css">
|
16 | ```
|
17 |
|
18 | If you're using the default markdown-it parser, I also recommend the github stylesheet:
|
19 | https://github.com/sindresorhus/github-markdown-css
|
20 |
|
21 | ## Examples
|
22 |
|
23 | ### Inline
|
24 | Surround your LaTeX with a single `$` on each side for inline rendering.
|
25 | ```
|
26 | $\sqrt{3x-1}+(1+x)^2$
|
27 | ```
|
28 |
|
29 | ### Block
|
30 | Use two (`$$`) for block rendering. This mode uses bigger symbols and centers
|
31 | the result.
|
32 |
|
33 | ```
|
34 | $$\begin{array}{c}
|
35 |
|
36 | \nabla \times \vec{\mathbf{B}} -\, \frac1c\, \frac{\partial\vec{\mathbf{E}}}{\partial t} &
|
37 | = \frac{4\pi}{c}\vec{\mathbf{j}} \nabla \cdot \vec{\mathbf{E}} & = 4 \pi \rho \\
|
38 |
|
39 | \nabla \times \vec{\mathbf{E}}\, +\, \frac1c\, \frac{\partial\vec{\mathbf{B}}}{\partial t} & = \vec{\mathbf{0}} \\
|
40 |
|
41 | \nabla \cdot \vec{\mathbf{B}} & = 0
|
42 |
|
43 | \end{array}$$
|
44 | ```
|
45 |
|
46 | ## Math Syntax Support
|
47 |
|
48 | KaTeX is based on TeX and LaTeX. Support for both is growing. Here's a list of
|
49 | currently supported functions:
|
50 |
|
51 | [Function Support in KaTeX](https://github.com/Khan/KaTeX/wiki/Function-Support-in-KaTeX)
|