|
|
@ -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);
|
|
|
|