[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/markdown-mode d9ea5dbc6a 3/4: Merge pull request #676 from
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/markdown-mode d9ea5dbc6a 3/4: Merge pull request #676 from vspinu/protect-eob-math-double |
Date: |
Sat, 15 Jan 2022 10:58:48 -0500 (EST) |
branch: elpa/markdown-mode
commit d9ea5dbc6af274b15ee4d912036957754e13be82
Merge: ba8de41d86 fac0a91898
Author: Shohei YOSHIDA <syohex@gmail.com>
Commit: GitHub <noreply@github.com>
Merge pull request #676 from vspinu/protect-eob-math-double
Check if not at eob in markdown-match-math-double
---
markdown-mode.el | 3 ++-
tests/markdown-test.el | 10 ++++++++++
2 files changed, 12 insertions(+), 1 deletion(-)
diff --git a/markdown-mode.el b/markdown-mode.el
index a4d08fd106..270fddfd3b 100644
--- a/markdown-mode.el
+++ b/markdown-mode.el
@@ -2970,7 +2970,8 @@ $..$ or `markdown-regex-math-inline-double' for matching
$$..$$."
(defun markdown-match-math-double (last)
"Match double quoted $$..$$ math from point to LAST."
(when markdown-enable-math
- (when (and (char-equal (char-after) ?$)
+ (when (and (< (1+ (point)) (point-max))
+ (char-equal (char-after) ?$)
(char-equal (char-after (1+ (point))) ?$)
(not (bolp))
(not (char-equal (char-before) ?\\))
diff --git a/tests/markdown-test.el b/tests/markdown-test.el
index b59ddb278c..cf60868878 100644
--- a/tests/markdown-test.el
+++ b/tests/markdown-test.el
@@ -5955,6 +5955,16 @@ Detail:
https://github.com/jrblevin/markdown-mode/issues/352"
(markdown-test-range-has-face 9 9 'markdown-math-face)
(markdown-test-range-has-face 10 11 'markdown-markup-face))))
+(ert-deftest test-markdown-math/math-inline-small-buffer ()
+ "Test that font-lock parsing works with a single dollar."
+ (let ((markdown-enable-math t))
+ (markdown-test-string "$"
+ (should t))
+ (markdown-test-string "$$"
+ (should t))
+ (markdown-test-string "$$$"
+ (should t))))
+
;;; Extension: pipe table editing
(ert-deftest test-markdown-table/table-begin-top-of-file ()