mirror of
git://git.sv.gnu.org/emacs.git
synced 2026-06-14 12:31:25 +00:00
Fix markdown-ts-mode atx_heading face computation (bug#81042)
The grammar reports leading spaces as part of the atx_heading "marker" and we cannot use the length of the marker as a result. Instead, count the number of consecutive # after any blanks to determine its "level." * lisp/textmodes/markdown-ts-mode.el (markdown-ts--fontify-atx-heading): Count the octothorpes rather than using the length of the marker node's text.
This commit is contained in:
parent
997fc2cef7
commit
e0aeee2dc5
1 changed files with 6 additions and 2 deletions
|
|
@ -1093,8 +1093,12 @@ CommonMark they are decorative and must be preceded by a space or tab."
|
||||||
(let* ((n-start (treesit-node-start node))
|
(let* ((n-start (treesit-node-start node))
|
||||||
(n-end (treesit-node-end node))
|
(n-end (treesit-node-end node))
|
||||||
(face (let ((marker (treesit-node-child node 0)))
|
(face (let ((marker (treesit-node-child node 0)))
|
||||||
(intern (format "markdown-ts-heading-%d"
|
(intern
|
||||||
(length (treesit-node-text marker t)))))))
|
(format "markdown-ts-heading-%d"
|
||||||
|
(progn
|
||||||
|
(string-match "[[:blank:]]*\\([#]+\\)"
|
||||||
|
(treesit-node-text marker t))
|
||||||
|
(- (match-end 1) (match-beginning 1))))))))
|
||||||
(font-lock--remove-face-from-text-property n-start n-end 'face face)
|
(font-lock--remove-face-from-text-property n-start n-end 'face face)
|
||||||
(font-lock-append-text-property n-start (1- n-end) 'face face)
|
(font-lock-append-text-property n-start (1- n-end) 'face face)
|
||||||
(save-excursion
|
(save-excursion
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue