[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/markdown-mode ad3a816f7b 4/4: Merge pull request #757 from
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/markdown-mode ad3a816f7b 4/4: Merge pull request #757 from jrblevin/improve/issue-753 |
Date: |
Fri, 31 Mar 2023 06:00:44 -0400 (EDT) |
branch: elpa/markdown-mode
commit ad3a816f7be97deb83fc0a7fa41305c79009bac5
Merge: 2d79c3b95c 2e7098bb96
Author: Shohei YOSHIDA <syohex@gmail.com>
Commit: GitHub <noreply@github.com>
Merge pull request #757 from jrblevin/improve/issue-753
Improve horizontal rule rendering in markdown-view-mode
---
CHANGES.md | 1 +
markdown-mode.el | 29 +++++++++++++++++++++--------
2 files changed, 22 insertions(+), 8 deletions(-)
diff --git a/CHANGES.md b/CHANGES.md
index f2a4fe4e32..fb1f791c61 100644
--- a/CHANGES.md
+++ b/CHANGES.md
@@ -21,6 +21,7 @@
- `clear-image-cache` to make toggle inline image update.
- Highlight autolinks if a scheme is valid and it is not registered in
markdown-uri-types
[GH-743][]
+ - Improve horizontal rule rendering in `markdown-view-mode` [GH-753][]
* Bug fixes:
- Don't override table faces by link faces [GH-716][]
diff --git a/markdown-mode.el b/markdown-mode.el
index 0e65dc7dd1..6bdf03abb2 100644
--- a/markdown-mode.el
+++ b/markdown-mode.el
@@ -3509,17 +3509,30 @@ SEQ may be an atom or a sequence."
`(display ,display-string))))))))
t))
+(defun markdown--fontify-hrs-view-mode (hr-char)
+ (if (and hr-char (display-supports-face-attributes-p '(:extend t)))
+ (add-text-properties
+ (match-beginning 0) (match-end 0)
+ `(face
+ (:inherit markdown-hr-face :underline t :extend t)
+ font-lock-multiline t
+ display "\n"))
+ (let ((hr-len (and hr-char (/ (1- (window-body-width)) (char-width
hr-char)))))
+ (add-text-properties
+ (match-beginning 0) (match-end 0)
+ `(face
+ markdown-hr-face font-lock-multiline t
+ display ,(make-string hr-len hr-char))))))
+
(defun markdown-fontify-hrs (last)
"Add text properties to horizontal rules from point to LAST."
(when (markdown-match-hr last)
- (let* ((hr-char (markdown--first-displayable markdown-hr-display-char))
- (hr-len (and hr-char (/ (window-max-chars-per-line) (char-width
hr-char)))))
- (add-text-properties
- (match-beginning 0) (match-end 0)
- `(face markdown-hr-face
- font-lock-multiline t
- ,@(when (and markdown-hide-markup hr-char)
- `(display ,(make-string hr-len hr-char)))))
+ (let ((hr-char (markdown--first-displayable markdown-hr-display-char)))
+ (if (and markdown-hide-markup hr-char)
+ (markdown--fontify-hrs-view-mode hr-char)
+ (add-text-properties
+ (match-beginning 0) (match-end 0)
+ `(face markdown-hr-face font-lock-multiline t)))
t)))
(defun markdown-fontify-sub-superscripts (last)