mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +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) {
|
const katexInline = function (latex) {
|
||||||
options.displayMode = false;
|
options.displayMode = false;
|
||||||
try {
|
try {
|
||||||
|
latex = latex.replace(/\\def{\\([a-zA-Z0-9]+)}/g, '\\def\\$1');
|
||||||
return katex.renderToString(latex, options);
|
return katex.renderToString(latex, options);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (options.throwOnError) logger.error(error);
|
if (options.throwOnError) logger.error(error);
|
||||||
@@ -117,6 +118,7 @@ module.exports = function plugin(md) {
|
|||||||
const katexBlock = function (latex) {
|
const katexBlock = function (latex) {
|
||||||
options.displayMode = true;
|
options.displayMode = true;
|
||||||
try {
|
try {
|
||||||
|
latex = latex.replace(/\\def{\\([a-zA-Z0-9]+)}/g, '\\def\\$1');
|
||||||
return `<p>${katex.renderToString(latex, options)}</p>`;
|
return `<p>${katex.renderToString(latex, options)}</p>`;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (options.throwOnError) logger.error(error);
|
if (options.throwOnError) logger.error(error);
|
||||||
|
|||||||
Reference in new issue
Block a user