[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/markdown-mode cb1d01c9f3 1/2: Fix markdown-fontify-whole-h
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/markdown-mode cb1d01c9f3 1/2: Fix markdown-fontify-whole-heading-line regression |
Date: |
Wed, 6 Nov 2024 01:00:12 -0500 (EST) |
branch: elpa/markdown-mode
commit cb1d01c9f3a5906a4832d3b7b4ac61ba4166c4d5
Author: Shohei YOSHIDA <syohex@gmail.com>
Commit: Shohei YOSHIDA <syohex@gmail.com>
Fix markdown-fontify-whole-heading-line regression
---
CHANGES.md | 2 ++
markdown-mode.el | 25 ++++++++++---------------
tests/markdown-test.el | 14 ++++++--------
3 files changed, 18 insertions(+), 23 deletions(-)
diff --git a/CHANGES.md b/CHANGES.md
index 411102ba5a..1241a8f19e 100644
--- a/CHANGES.md
+++ b/CHANGES.md
@@ -20,6 +20,7 @@
- Fix the regexp in the download languages script [GH-827][]
- Don't hide backslashes in code blocks when using `markdown-hide-markup`
and `markdown-fontify-code-blocks-natively` together [GH-766][]
+ - Fix `markdown-fontify-whole-heading-line` regression [GH-848][]
* Improvements:
- Apply url-unescape against URL in an inline link [GH-805][]
@@ -33,6 +34,7 @@
[gh-817]: https://github.com/jrblevin/markdown-mode/issues/817
[gh-827]: https://github.com/jrblevin/markdown-mode/issues/827
[gh-834]: https://github.com/jrblevin/markdown-mode/issues/834
+ [gh-848]: https://github.com/jrblevin/markdown-mode/issues/848
# Markdown Mode 2.6
diff --git a/markdown-mode.el b/markdown-mode.el
index e0db80da62..ad1ae73959 100644
--- a/markdown-mode.el
+++ b/markdown-mode.el
@@ -3559,30 +3559,25 @@ SEQ may be an atom or a sequence."
(add-text-properties
(match-beginning 3) (match-end 3) rule-props)))
;; atx heading
- (let ((header-end
+ (let ((fontified-start
+ (if (or markdown-hide-markup (not
markdown-fontify-whole-heading-line))
+ (match-beginning 5)
+ (match-beginning 0)))
+ (fontified-end
(if markdown-fontify-whole-heading-line
(min (point-max) (1+ (match-end 0)))
- (match-end 0))))
+ (match-end 5))))
(add-text-properties
(match-beginning 4) (match-end 4) left-markup-props)
;; If closing tag is present
(if (match-end 6)
(progn
- (if markdown-hide-markup
- (progn
- (add-text-properties
- (match-beginning 5) header-end heading-props)
- (add-text-properties
- (match-beginning 6) (match-end 6) right-markup-props))
- (add-text-properties
- (match-beginning 5) (match-end 5) heading-props)
- (add-text-properties
- (match-beginning 6) header-end right-markup-props)))
+ (add-text-properties fontified-start fontified-end
heading-props)
+ (when (or markdown-hide-markup (not
markdown-fontify-whole-heading-line))
+ (add-text-properties (match-beginning 6) (match-end 6)
right-markup-props)))
;; If closing tag is not present
- (add-text-properties
- (match-beginning 5) header-end heading-props))
- )))
+ (add-text-properties fontified-start fontified-end
heading-props)))))
t))
(defun markdown-fontify-tables (last)
diff --git a/tests/markdown-test.el b/tests/markdown-test.el
index b1a881dcaa..ee61abd364 100644
--- a/tests/markdown-test.el
+++ b/tests/markdown-test.el
@@ -3073,19 +3073,17 @@ puts markdown.to_html
(let ((markdown-fontify-whole-heading-line t))
(let ((markdown-hide-markup nil))
(markdown-test-string "## abc \n"
- (markdown-test-range-has-face 4 9
'markdown-header-face-2))
+ (markdown-test-range-has-face 1 8 'markdown-header-face-2))
(markdown-test-string "## abc ##\n"
- (markdown-test-range-has-face 4 6
'markdown-header-face-2)
- (markdown-test-range-has-face 7 10
'markdown-header-delimiter-face)))
+ (markdown-test-range-has-face 1 9 'markdown-header-face-2)))
(let ((markdown-hide-markup t))
(markdown-test-string "## abc \n"
- (markdown-test-range-has-face 4 9
'markdown-header-face-2))
+ (markdown-test-range-has-face 4 9 'markdown-header-face-2))
(markdown-test-string "## abc ##\n"
- (markdown-test-range-has-face 4 6
'markdown-header-face-2)
- (markdown-test-range-has-face 7 9
'markdown-header-delimiter-face)
- (markdown-test-range-has-face 10 10
'markdown-header-face-2))
- )))
+ (markdown-test-range-has-face 4 6 'markdown-header-face-2)
+ (markdown-test-range-has-face 7 9 'markdown-header-delimiter-face)
+ (markdown-test-range-has-face 10 10 'markdown-header-face-2)))))
(ert-deftest test-markdown-font-lock/setext-1-letter ()
"An edge case for level-one setext headers."
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [nongnu] elpa/markdown-mode cb1d01c9f3 1/2: Fix markdown-fontify-whole-heading-line regression,
ELPA Syncer <=