-
Hi, I wondered if there is some programmatic test for whether a function is supported, instead of looking at https://katex.org/docs/supported.html. Thanks |
Beta Was this translation helpful? Give feedback.
Answered by
edemaine
Aug 12, 2021
Replies: 1 comment 1 reply
-
I believe the following code will work, e.g. function supported (command) {
let rendered;
try {
rendered = katex.renderToString(command, {throwOnError: false, errorColor: 'INVALID'});
} catch {
return true;
}
return !/color:INVALID/.test(rendered);
} |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
hrbigelow
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I believe the following code will work, e.g.
supported('\\foo')
: