Go to file
ylemkimon 20c9440318 Add markdown-help command and auto-generate CLI documentation (#1518)
* Add `markdown-help` command and update CLI documentation

* Auto-generate cli.md before start, build, and publish

* Update cli.md.template
2018-07-30 01:44:43 +09:00
2018-07-26 18:50:51 -07:00
2018-07-24 02:01:02 +09:00
2015-06-26 13:57:02 -07:00
2018-07-28 10:49:36 -04:00
2015-04-01 15:57:10 -07:00
2018-07-28 10:49:36 -04:00
2018-07-28 10:49:36 -04:00
2018-07-29 12:26:41 -04:00
2018-07-07 13:17:05 -04:00

KaTeX

npm Build Status CircleCI codecov Join the chat at https://gitter.im/Khan/KaTeX Greenkeeper badge

KaTeX is a fast, easy-to-use JavaScript library for TeX math rendering on the web.

  • 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.
  • Print quality: KaTeXs layout is based on Donald Knuths TeX, the gold standard for math typesetting.
  • Self contained: KaTeX has no dependencies and can easily be bundled with your website resources.
  • 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.

KaTeX is compatible with all major browsers, including Chrome, Safari, Firefox, Opera, Edge, and IE 9 - IE 11.

KaTeX supports much (but not all) of LaTeX and many LaTeX packages. See the list of supported functions.

Getting started

Download KaTeX and host it on your server or include the katex.min.js and katex.min.css files on your page directly from a CDN:

<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.10.0-beta/dist/katex.min.css" integrity="sha384-9tPv11A+glH/on/wEu99NVwDPwkMQESOocs/ZGXPoIiLE8MU/qkqUcZ3zzL+6DuH" crossorigin="anonymous">
<script src="https://cdn.jsdelivr.net/npm/katex@0.10.0-beta/dist/katex.min.js" integrity="sha384-U8Vrjwb8fuHMt6ewaCy8uqeUXv4oitYACKdB0VziCerzt011iQ/0TqlSlv8MReCm" crossorigin="anonymous"></script>

In-browser rendering

Call katex.render with a TeX expression and a DOM element to render into:

katex.render("c = \\pm\\sqrt{a^2 + b^2}", element);

If KaTeX can't parse the expression, it throws a katex.ParseError error.

Rendering expressions in text elements

To automatically render math in text elements, include the auto-render script contrib/auto-render.min.js, or via CDN:

<script src="https://cdn.jsdelivr.net/npm/katex@0.10.0-beta/dist/contrib/auto-render.min.js" integrity="sha384-aGfk5kvhIq5x1x5YdvCp4upKZYnA8ckafviDpmWEKp4afOZEqOli7gqSnh8I6enH" crossorigin="anonymous"></script>

Then, call the renderMathInElement function with a DOM element containing expressions in a script tag before the closing body tag:

<body>
  ...
  <script>
    renderMathInElement(document.body);
  </script>
</body>

See Auto-render Extension for more details.

Server side rendering or rendering to a string

To generate HTML on the server or to generate an HTML string of the rendered math, you can use katex.renderToString:

var html = katex.renderToString("c = \\pm\\sqrt{a^2 + b^2}");
// '<span class="katex">...</span>'

Make sure to include the CSS and font files, but there is no need to include the JavaScript. Like render, renderToString throws if it can't parse the expression.

Documentation

Learn more about using KaTeX on the website!

Contributing

See CONTRIBUTING.md

License

KaTeX is licensed under the MIT License.

Description
KaTeX fork
Readme MIT 71 MiB
Languages
JavaScript 85.7%
Perl 4.6%
Prolog 3.2%
HTML 2.3%
Less 1.3%
Other 2.8%