* eldoc-box.el (eldoc-box--fontify-html): Prettify HTML entities.
This commit is contained in:
parent
17b86a8acd
commit
d7d302989e
21
eldoc-box.el
21
eldoc-box.el
@ -65,8 +65,10 @@
|
|||||||
|
|
||||||
;;; Code:
|
;;; Code:
|
||||||
|
|
||||||
|
(eval-when-compile
|
||||||
(require 'cl-lib)
|
(require 'cl-lib)
|
||||||
(require 'seq)
|
(require 'pcase)
|
||||||
|
(require 'seq))
|
||||||
|
|
||||||
;;;; Userland
|
;;;; Userland
|
||||||
;;;;; Variable
|
;;;;; Variable
|
||||||
@ -164,7 +166,7 @@ It will be passes with two arguments: WIDTH and HEIGHT of the childframe.")
|
|||||||
(defvar eldoc-box-buffer-hook '(eldoc-box--prettify-markdown-separator
|
(defvar eldoc-box-buffer-hook '(eldoc-box--prettify-markdown-separator
|
||||||
eldoc-box--replace-en-space
|
eldoc-box--replace-en-space
|
||||||
eldoc-box--remove-linked-images
|
eldoc-box--remove-linked-images
|
||||||
eldoc-box--fontify-html-header
|
eldoc-box--fontify-html
|
||||||
eldoc-box--condense-large-newline-gaps)
|
eldoc-box--condense-large-newline-gaps)
|
||||||
"Hook run after buffer for doc is setup.
|
"Hook run after buffer for doc is setup.
|
||||||
Run inside the new buffer. By default, it contains some Markdown
|
Run inside the new buffer. By default, it contains some Markdown
|
||||||
@ -664,9 +666,10 @@ height."
|
|||||||
nil t)
|
nil t)
|
||||||
(replace-match ""))))
|
(replace-match ""))))
|
||||||
|
|
||||||
(defun eldoc-box--fontify-html-header ()
|
(defun eldoc-box--fontify-html ()
|
||||||
"Fontify <h1> <h2> tags."
|
"Fontify HTML tags and special entities."
|
||||||
(save-excursion
|
(save-excursion
|
||||||
|
;; <h1> tags.
|
||||||
(goto-char (point-min))
|
(goto-char (point-min))
|
||||||
(while (re-search-forward
|
(while (re-search-forward
|
||||||
(rx bol
|
(rx bol
|
||||||
@ -682,7 +685,15 @@ height."
|
|||||||
(put-text-property (match-beginning 1) (match-end 1)
|
(put-text-property (match-beginning 1) (match-end 1)
|
||||||
'invisible t)
|
'invisible t)
|
||||||
(put-text-property (match-beginning 3) (match-end 3)
|
(put-text-property (match-beginning 3) (match-end 3)
|
||||||
'invisible t))))
|
'invisible t))
|
||||||
|
;; Special entities.
|
||||||
|
(goto-char (point-min))
|
||||||
|
(while (re-search-forward (rx (or "<" ">")) nil t)
|
||||||
|
(put-text-property (match-beginning 0) (match-end 0)
|
||||||
|
'display
|
||||||
|
(pcase (match-string 0)
|
||||||
|
("<" "<")
|
||||||
|
(">" ">"))))))
|
||||||
|
|
||||||
(provide 'eldoc-box)
|
(provide 'eldoc-box)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user