From 4ae496035873e56520226f6eaa230d354174c061 Mon Sep 17 00:00:00 2001 From: Le Tan Date: Wed, 31 Oct 2018 22:11:40 +0800 Subject: [PATCH] markdown-it: MathJax support $.$ in \text{} within $$...$$ --- src/resources/markdown_template.js | 1 + src/utils/markdown-it/markdown-it-texmath.js | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/resources/markdown_template.js b/src/resources/markdown_template.js index 5cb92548..60b8d4e4 100644 --- a/src/resources/markdown_template.js +++ b/src/resources/markdown_template.js @@ -1873,3 +1873,4 @@ var clearMarkRectDivs = function() { var startFreshRender = function() { skipScrollCheckRange = null; }; + diff --git a/src/utils/markdown-it/markdown-it-texmath.js b/src/utils/markdown-it/markdown-it-texmath.js index 0395b3f9..0ed249b3 100644 --- a/src/utils/markdown-it/markdown-it-texmath.js +++ b/src/utils/markdown-it/markdown-it-texmath.js @@ -161,12 +161,12 @@ texmath.rules = { ], block: [ { name: 'math_block_eqno', - rex: /\${2}([^$]*?)\${2}\s*?\(([^)$\r\n]+?)\)\s*$/gmy, + rex: /\${2}((?:[^$]|\$(?!\$))*?)\${2}\s*?\(([^)$\r\n]+?)\)\s*$/gmy, tmpl: '$1($2)', tag: '$$' }, { name: 'math_block', - rex: /\${2}([^$]*?)\${2}\s*$/gmy, + rex: /\${2}((?:[^$]|\$(?!\$))*?)\${2}\s*$/gmy, tmpl: '$1', tag: '$$' }