fix markdown-it-texmath

This commit is contained in:
Le Tan 2020-12-15 22:44:23 +08:00
parent bb3f03fb17
commit e55434965b
2 changed files with 5 additions and 2 deletions

View File

@ -5,6 +5,7 @@
'use strict'; 'use strict';
function texmath(md, options) { function texmath(md, options) {
texmath.escapeHtml = md.utils.escapeHtml;
const delimitersList = options && options.delimitersList || ['dollars']; const delimitersList = options && options.delimitersList || ['dollars'];
const katexOptions = options && options.katexOptions || { throwOnError: false }; const katexOptions = options && options.katexOptions || { throwOnError: false };
katexOptions.macros = options && options.macros || katexOptions.macros; // ensure backwards compatibility katexOptions.macros = options && options.macros || katexOptions.macros; // ensure backwards compatibility
@ -113,9 +114,9 @@ texmath.render = function(tex,displayMode,options) {
} }
*/ */
if (displayMode) { if (displayMode) {
res = '$$$$' + tex + '$$$$'; res = '$$$$' + texmath.escapeHtml(tex) + '$$$$';
} else { } else {
res = '$$' + tex + '$$'; res = '$$' + texmath.escapeHtml(tex) + '$$';
} }
return res; return res;
} }

View File

@ -1007,3 +1007,5 @@ void ViewWindow::showReplaceResult(const QString &p_text, int p_totalReplaces)
VNoteX::getInst().showStatusMessageShort(tr("Replaced %n match(es)", "", p_totalReplaces)); VNoteX::getInst().showStatusMessageShort(tr("Replaced %n match(es)", "", p_totalReplaces));
} }
} }