mirror of
https://github.com/Smaug123/KaTeX
synced 2025-10-05 11:18:39 +00:00
Create globalGroup option to place definitions in global scope (#2091)
If true, this allows \newcommand definitions to persist across calls to renderToString. Fix https://github.com/KaTeX/KaTeX/issues/2070
This commit is contained in:
committed by
Kevin Barabash
parent
f03671ce61
commit
36595343b7
@@ -51,6 +51,7 @@ You can provide an object of options as the last argument to [`katex.render` and
|
||||
- Allow all commands with specific protocols: `trust: (context) => ['http', 'https', '_relative'].includes(context.protocol)`
|
||||
- Allow all commands but forbid specific protocol: `trust: (context) => context.protocol !== 'file'`
|
||||
- Allow certain commands with specific protocols: `trust: (context) => ['\\url', '\\href'].includes(context.command) && ['http', 'https', '_relative'].includes(context.protocol)`
|
||||
- `globalGroup`: `boolean` (default: `false`). Place KaTeX code in the global group. As a consequence, `\def` and `\newcommand` persist in `macros` across render calls. In LaTeX, constructs such as `\begin{equation}` and `$$` create a local group and prevent definitions from becoming visible outside of those blocks.
|
||||
|
||||
For example:
|
||||
|
||||
|
Reference in New Issue
Block a user