mirror of
https://github.com/Smaug123/KaTeX
synced 2025-10-05 11:18:39 +00:00
Improve server-side rendering documentation (#2178)
* Improve server-side rendering documentation * Fix typo * Document Node + mhchem * Re-order require statements Co-authored-by: ylemkimon <mail@ylem.kim>
This commit is contained in:
23
docs/node.md
23
docs/node.md
@@ -75,4 +75,25 @@ import katex from 'katex/dist/katex.mjs'
|
||||
```
|
||||
|
||||
> The ES module contains ES6 syntaxes and features, and may need transpiling to
|
||||
use in old environments:
|
||||
use in old environments.
|
||||
|
||||
See the [API](api.html) for available functions in the `katex` module.
|
||||
|
||||
## Including in webpages
|
||||
|
||||
To render any HTML generated by e.g. `katex.renderToString`, you will
|
||||
still need to link the CSS file, make the KaTeX font files available to the
|
||||
client, and use the HTML5 doctype. See [browser usage](browser.html).
|
||||
Note, however, that you do not need to include `katex.js` on the client.
|
||||
|
||||
## Using mhchem extension
|
||||
|
||||
The [mhchem extension](https://github.com/Khan/KaTeX/tree/master/contrib/mhchem)
|
||||
adds its features by modifying the `katex` module. So you can use KaTeX with
|
||||
mhchem in Node as follows:
|
||||
|
||||
```js
|
||||
const katex = require('katex');
|
||||
require('katex/dist/contrib/mhchem.js'); // modify katex module
|
||||
const html = katex.renderToString('\\ce{CO2 + C -> 2 C0}");
|
||||
```
|
||||
|
Reference in New Issue
Block a user