[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/markdown-mode 8f6974ee0e 1/4: Support plus sign and Unicod
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/markdown-mode 8f6974ee0e 1/4: Support plus sign and Unicode minus sign |
Date: |
Tue, 18 Jan 2022 10:58:17 -0500 (EST) |
branch: elpa/markdown-mode
commit 8f6974ee0ebf4dec7a9f5246b7395b0aec014594
Author: Shohei YOSHIDA <syohex@gmail.com>
Commit: Shohei YOSHIDA <syohex@gmail.com>
Support plus sign and Unicode minus sign
---
CHANGES.md | 2 +-
markdown-mode.el | 2 +-
tests/markdown-test.el | 17 +++++++++++++++--
3 files changed, 17 insertions(+), 4 deletions(-)
diff --git a/CHANGES.md b/CHANGES.md
index 1de421a5c1..d94d9352d3 100644
--- a/CHANGES.md
+++ b/CHANGES.md
@@ -48,7 +48,7 @@
- Auto set `sh-shell` when `markdown-edit-code-block` enter indirect
buffer with `sh-mode`
- Add value check and avoid raising the exception at
`markdown-edit-code-block` [GH-663][]
- Add NonGNU ELPA badge to README and website
- - Support negative exponent in super script [GH-346][]
+ - Support plus/negative(also Unicode minus sign) exponent in super
script [GH-346][]
* Bug fixes:
- Fix issue with `nil` being returned from
`markdown-imenu-create-nested-index` [GH-578][]
diff --git a/markdown-mode.el b/markdown-mode.el
index 119aec3be9..009eed31c9 100644
--- a/markdown-mode.el
+++ b/markdown-mode.el
@@ -995,7 +995,7 @@ Compatible with Pandoc, Python Markdown, PHP Markdown
Extra, and Leanpub.")
"Regular expression for Leanpub section markers and related syntax.")
(defconst markdown-regex-sub-superscript
-
"\\(?:^\\|[^\\~^]\\)\\(?1:\\(?2:[~^]\\)\\(?3:[-]?[[:alnum:]]+\\)\\(?4:\\2\\)\\)"
+
"\\(?:^\\|[^\\~^]\\)\\(?1:\\(?2:[~^]\\)\\(?3:[+-\u2212]?[[:alnum:]]+\\)\\(?4:\\2\\)\\)"
"The regular expression matching a sub- or superscript.
The leading un-numbered group matches the character before the
opening tilde or carat, if any, ensuring that it is not a
diff --git a/tests/markdown-test.el b/tests/markdown-test.el
index 6042cea2e6..097780d6fd 100644
--- a/tests/markdown-test.el
+++ b/tests/markdown-test.el
@@ -3337,11 +3337,24 @@ takes precedence)."
(markdown-test-range-has-face 4 4 'markdown-markup-face) ; First ^
(markdown-test-range-has-face 5 6 nil) ; 10
(markdown-test-range-has-face 7 7 'markdown-markup-face)) ; Second ^
- (markdown-test-string "1.0 x 10^-15^"
+ (markdown-test-string "1.0 x 10^-15^
+10^+15^"
+ ;; -
(markdown-test-range-has-face 1 8 nil)
(markdown-test-range-has-face 9 9 'markdown-markup-face)
(markdown-test-range-has-face 10 12 nil)
- (markdown-test-range-has-face 13 13 'markdown-markup-face)))
+ (markdown-test-range-has-face 13 13 'markdown-markup-face)
+ ;; +
+ (markdown-test-range-has-face 15 16 nil)
+ (markdown-test-range-has-face 17 17 'markdown-markup-face)
+ (markdown-test-range-has-face 18 20 nil)
+ (markdown-test-range-has-face 21 21 'markdown-markup-face))
+ ;; Unicode minus sign
+ (markdown-test-string "10^−15^" ;; unicode minus sign U+2212
+ (search-forward "^")
+ (markdown-test-range-has-face (1- (point)) (1- (point))
'markdown-markup-face)
+ (search-forward "^")
+ (markdown-test-range-has-face (1- (point)) (1- (point))
'markdown-markup-face)))
(ert-deftest test-markdown-font-lock/hidden-urls-inline ()
"Test URL hiding and toggling."