arnaucube.com/blogo-input/js/katex/README.md
blogo-input/js/katex/README.mdRaw
1# [<img src="https://katex.org/img/katex-logo-black.svg" width="130" alt="KaTeX">](https://katex.org/)
2[](https://www.npmjs.com/package/katex)
3[](https://github.com/semantic-release/semantic-release)
4[](https://github.com/KaTeX/KaTeX/actions?query=workflow%3ACI)
5[](https://codecov.io/gh/KaTeX/KaTeX)
6[](https://github.com/KaTeX/KaTeX/discussions)
7[](https://www.jsdelivr.com/package/npm/katex)
8
9[](https://gitpod.io/#https://github.com/KaTeX/KaTeX)
10[](https://opencollective.com/katex)
11
12KaTeX is a fast, easy-to-use JavaScript library for TeX math rendering on the web.
13
14 * **Fast:** KaTeX renders its math synchronously and doesn't need to reflow the page. See how it compares to a competitor in [this speed test](http://www.intmath.com/cg5/katex-mathjax-comparison.php).
15 * **Print quality:** KaTeX's layout is based on Donald Knuth's TeX, the gold standard for math typesetting.
16 * **Self contained:** KaTeX has no dependencies and can easily be bundled with your website resources.
17 * **Server side rendering:** KaTeX produces the same output regardless of browser or environment, so you can pre-render expressions using Node.js and send them as plain HTML.
18
19KaTeX is compatible with all major browsers, including Chrome, Safari, Firefox, Opera, Edge, and IE 11.
20
21KaTeX supports much (but not all) of LaTeX and many LaTeX packages. See the [list of supported functions](https://katex.org/docs/supported.html).
22
23Try out KaTeX [on the demo page](https://katex.org/#demo)!
24
25## Getting started
26
27### Starter template
28
29```html
30<!DOCTYPE html>
31<!-- KaTeX requires the use of the HTML5 doctype. Without it, KaTeX may not render properly -->
32<html>
33 <head>
34 <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.15.3/dist/katex.min.css" integrity="sha384-KiWOvVjnN8qwAZbuQyWDIbfCLFhLXNETzBQjA/92pIowpC0d2O3nppDGQVgwd2nB" crossorigin="anonymous">
35
36 <!-- The loading of KaTeX is deferred to speed up page rendering -->
37 <script defer src="https://cdn.jsdelivr.net/npm/katex@0.15.3/dist/katex.min.js" integrity="sha384-0fdwu/T/EQMsQlrHCCHoH10pkPLlKA1jL5dFyUOvB3lfeT2540/2g6YgSi2BL14p" crossorigin="anonymous"></script>
38
39 <!-- To automatically render math in text elements, include the auto-render extension: -->
40 <script defer src="https://cdn.jsdelivr.net/npm/katex@0.15.3/dist/contrib/auto-render.min.js" integrity="sha384-+XBljXPPiv+OzfbB3cVmLHf4hdUFHlWNZN5spNQ7rmHTXpd7WvJum6fIACpNNfIR" crossorigin="anonymous"
41 onload="renderMathInElement(document.body);"></script>
42 </head>
43 ...
44</html>
45```
46
47You can also [download KaTeX](https://github.com/KaTeX/KaTeX/releases) and host it yourself.
48
49For details on how to configure auto-render extension, refer to [the documentation](https://katex.org/docs/autorender.html).
50
51### API
52
53Call `katex.render` to render a TeX expression directly into a DOM element.
54For example:
55
56```js
57katex.render("c = \\pm\\sqrt{a^2 + b^2}", element, {
58 throwOnError: false
59});
60```
61
62Call `katex.renderToString` to generate an HTML string of the rendered math,
63e.g., for server-side rendering. For example:
64
65```js
66var html = katex.renderToString("c = \\pm\\sqrt{a^2 + b^2}", {
67 throwOnError: false
68});
69// '<span class="katex">...</span>'
70```
71
72Make sure to include the CSS and font files in both cases.
73If you are doing all rendering on the server, there is no need to include the
74JavaScript on the client.
75
76The examples above use the `throwOnError: false` option, which renders invalid
77inputs as the TeX source code in red (by default), with the error message as
78hover text. For other available options, see the
79[API documentation](https://katex.org/docs/api.html),
80[options documentation](https://katex.org/docs/options.html), and
81[handling errors documentation](https://katex.org/docs/error.html).
82
83## Demo and Documentation
84
85Learn more about using KaTeX [on the website](https://katex.org)!
86
87## Contributors
88
89### Code Contributors
90
91This project exists thanks to all the people who contribute code. If you'd like to help, see [our guide to contributing code](CONTRIBUTING.md).
92<a href="https://github.com/KaTeX/KaTeX/graphs/contributors"><img src="https://contributors-svg.opencollective.com/katex/contributors.svg?width=890&button=false" alt="Code contributors" /></a>
93
94### Financial Contributors
95
96Become a financial contributor and help us sustain our community.
97
98#### Individuals
99
100<a href="https://opencollective.com/katex"><img src="https://opencollective.com/katex/individuals.svg?width=890" alt="Contribute on Open Collective"></a>
101
102#### Organizations
103
104Support this project with your organization. Your logo will show up here with a link to your website.
105
106<a href="https://opencollective.com/katex/organization/0/website"><img src="https://opencollective.com/katex/organization/0/avatar.svg" alt="Organization 1"></a>
107<a href="https://opencollective.com/katex/organization/1/website"><img src="https://opencollective.com/katex/organization/1/avatar.svg" alt="Organization 2"></a>
108<a href="https://opencollective.com/katex/organization/2/website"><img src="https://opencollective.com/katex/organization/2/avatar.svg" alt="Organization 3"></a>
109<a href="https://opencollective.com/katex/organization/3/website"><img src="https://opencollective.com/katex/organization/3/avatar.svg" alt="Organization 4"></a>
110<a href="https://opencollective.com/katex/organization/4/website"><img src="https://opencollective.com/katex/organization/4/avatar.svg" alt="Organization 5"></a>
111<a href="https://opencollective.com/katex/organization/5/website"><img src="https://opencollective.com/katex/organization/5/avatar.svg" alt="Organization 6"></a>
112<a href="https://opencollective.com/katex/organization/6/website"><img src="https://opencollective.com/katex/organization/6/avatar.svg" alt="Organization 7"></a>
113<a href="https://opencollective.com/katex/organization/7/website"><img src="https://opencollective.com/katex/organization/7/avatar.svg" alt="Organization 8"></a>
114<a href="https://opencollective.com/katex/organization/8/website"><img src="https://opencollective.com/katex/organization/8/avatar.svg" alt="Organization 9"></a>
115<a href="https://opencollective.com/katex/organization/9/website"><img src="https://opencollective.com/katex/organization/9/avatar.svg" alt="Organization 10"></a>
116
117## License
118
119KaTeX is licensed under the [MIT License](http://opensource.org/licenses/MIT).