mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-17 17:36:08 +08:00
ui: fix \def in katex
This commit is contained in:
1 parent
ae4800b779
commit
d67a0339fd
1 file changed
+2
@@ -105,6 +105,7 @@ module.exports = function plugin(md) {
|
||||
const katexInline = function (latex) {
|
||||
options.displayMode = false;
|
||||
try {
|
||||
latex = latex.replace(/\\def{\\([a-zA-Z0-9]+)}/g, '\\def\\$1');
|
||||
return katex.renderToString(latex, options);
|
||||
} catch (error) {
|
||||
if (options.throwOnError) logger.error(error);
|
||||
@@ -117,6 +118,7 @@ module.exports = function plugin(md) {
|
||||
const katexBlock = function (latex) {
|
||||
options.displayMode = true;
|
||||
try {
|
||||
latex = latex.replace(/\\def{\\([a-zA-Z0-9]+)}/g, '\\def\\$1');
|
||||
return `<p>${katex.renderToString(latex, options)}</p>`;
|
||||
} catch (error) {
|
||||
if (options.throwOnError) logger.error(error);
|
||||
|
||||
Reference in new issue
Block a user