Function: markdown-fontify-headings
markdown-fontify-headings is a byte-compiled function defined in
markdown-mode.el.
Signature
(markdown-fontify-headings LAST)
Documentation
Add text properties to headings from point to LAST.
Source Code
;; Defined in ~/.emacs.d/elpa/markdown-mode-20260321.143/markdown-mode.el
(defun markdown-fontify-headings (last)
"Add text properties to headings from point to LAST."
(when (markdown-match-propertized-text 'markdown-heading last)
(let* ((level (markdown-outline-level))
(heading-face
(intern (format "markdown-header-face-%d" level)))
(heading-props `(face ,heading-face))
(left-markup-props
`(face markdown-header-delimiter-face
,@(cond
(markdown-hide-markup
`(display ""))
(markdown-marginalize-headers
`(display ((margin left-margin)
,(markdown--marginalize-string level)))))))
(right-markup-props
`(face markdown-header-delimiter-face
,@(when markdown-hide-markup `(display ""))))
(rule-props `(face markdown-header-rule-face
,@(when markdown-hide-markup `(display "")))))
(if (match-end 1)
;; Setext heading
(progn (add-text-properties
(match-beginning 1) (match-end 1) heading-props)
(if (= level 1)
(add-text-properties
(match-beginning 2) (match-end 2) rule-props)
(add-text-properties
(match-beginning 3) (match-end 3) rule-props)))
;; atx heading
(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 5))))
(add-text-properties
(match-beginning 4) (match-end 4) left-markup-props)
;; If closing tag is present
(if (match-end 6)
(progn
(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 fontified-start fontified-end heading-props)))))
t))