Function: markdown-fontify-code-blocks-generic
markdown-fontify-code-blocks-generic is a byte-compiled function
defined in markdown-mode.el.
Signature
(markdown-fontify-code-blocks-generic MATCHER LAST)
Documentation
Add text properties to next code block from point to LAST.
Use matching function MATCHER.
Source Code
;; Defined in ~/.emacs.d/elpa/markdown-mode-20260321.143/markdown-mode.el
(defun markdown-fontify-code-blocks-generic (matcher last)
"Add text properties to next code block from point to LAST.
Use matching function MATCHER."
(when (funcall matcher last)
(save-excursion
(save-match-data
(let* ((start (match-beginning 0))
(end (match-end 0))
;; Find positions outside opening and closing backquotes.
(bol-prev (progn (goto-char start)
(if (bolp) (line-beginning-position 0) (line-beginning-position))))
(eol-next (progn (goto-char end)
(if (bolp) (line-beginning-position 2) (line-beginning-position 3))))
lang)
(if (and markdown-fontify-code-blocks-natively
(or (setq lang (markdown-code-block-lang))
markdown-fontify-code-block-default-mode))
(markdown-fontify-code-block-natively lang start end)
(add-text-properties start end '(face markdown-pre-face)))
;; Set background for block as well as opening and closing lines.
(font-lock-append-text-property
bol-prev eol-next 'face 'markdown-code-face)
;; Set invisible property for lines before and after, including newline.
(add-text-properties bol-prev start '(invisible markdown-markup))
(add-text-properties end eol-next '(invisible markdown-markup)))))
t))