From e55434965b5509220f8182fb8b31f9689e7bf4b6 Mon Sep 17 00:00:00 2001 From: Le Tan Date: Tue, 15 Dec 2020 22:44:23 +0800 Subject: [PATCH] fix markdown-it-texmath --- src/data/extra/web/js/markdown-it/markdown-it-texmath.js | 5 +++-- src/widgets/viewwindow.cpp | 2 ++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/data/extra/web/js/markdown-it/markdown-it-texmath.js b/src/data/extra/web/js/markdown-it/markdown-it-texmath.js index d6e956ac..6d28ba9e 100644 --- a/src/data/extra/web/js/markdown-it/markdown-it-texmath.js +++ b/src/data/extra/web/js/markdown-it/markdown-it-texmath.js @@ -5,6 +5,7 @@ 'use strict'; function texmath(md, options) { + texmath.escapeHtml = md.utils.escapeHtml; const delimitersList = options && options.delimitersList || ['dollars']; const katexOptions = options && options.katexOptions || { throwOnError: false }; katexOptions.macros = options && options.macros || katexOptions.macros; // ensure backwards compatibility @@ -113,9 +114,9 @@ texmath.render = function(tex,displayMode,options) { } */ if (displayMode) { - res = '$$$$' + tex + '$$$$'; + res = '$$$$' + texmath.escapeHtml(tex) + '$$$$'; } else { - res = '$$' + tex + '$$'; + res = '$$' + texmath.escapeHtml(tex) + '$$'; } return res; } diff --git a/src/widgets/viewwindow.cpp b/src/widgets/viewwindow.cpp index 6bc5d37a..a0a100d3 100644 --- a/src/widgets/viewwindow.cpp +++ b/src/widgets/viewwindow.cpp @@ -1007,3 +1007,5 @@ void ViewWindow::showReplaceResult(const QString &p_text, int p_totalReplaces) VNoteX::getInst().showStatusMessageShort(tr("Replaced %n match(es)", "", p_totalReplaces)); } } + +