mirror of
https://github.com/Smaug123/KaTeX
synced 2025-10-05 19:28:39 +00:00
Documenting String.raw (#1198)
* Documenting String.raw * Typo * Rewrite String.raw doc
This commit is contained in:
@@ -30,6 +30,13 @@ Call `katex.render` with a TeX expression and a DOM element to render into:
|
||||
katex.render("c = \\pm\\sqrt{a^2 + b^2}", element);
|
||||
```
|
||||
|
||||
To avoid escaping the backslash (double backslash), you can use
|
||||
[`String.raw`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/raw)
|
||||
(but beware that `${`, `\u` and `\x` may still need escaping):
|
||||
```js
|
||||
katex.render(String.raw`c = \pm\sqrt{a^2 + b^2}`, element);
|
||||
```
|
||||
|
||||
If KaTeX can't parse the expression, it throws a `katex.ParseError` error.
|
||||
|
||||
#### Server side rendering or rendering to a string
|
||||
|
Reference in New Issue
Block a user