[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/markdown-mode e768745bf3 1/4: Improve horizontal rule rend
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/markdown-mode e768745bf3 1/4: Improve horizontal rule rendering in markdown-view-mode |
Date: |
Fri, 31 Mar 2023 06:00:43 -0400 (EDT) |
branch: elpa/markdown-mode
commit e768745bf3d1e5f6ceecfb6e0fe9d9c20442d852
Author: Shohei YOSHIDA <syohex@gmail.com>
Commit: Shohei YOSHIDA <syohex@gmail.com>
Improve horizontal rule rendering in markdown-view-mode
---
markdown-mode.el | 29 +++++++++++++++++++++--------
1 file changed, 21 insertions(+), 8 deletions(-)
diff --git a/markdown-mode.el b/markdown-mode.el
index 0e65dc7dd1..c36c6236b0 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 '(:underline 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)