Function: markdown-fontify-reference-links

markdown-fontify-reference-links is a byte-compiled function defined in markdown-mode.el.

Signature

(markdown-fontify-reference-links LAST)

Documentation

Add text properties to next reference link from point to LAST.

Source Code

;; Defined in ~/.emacs.d/elpa/markdown-mode-20260321.143/markdown-mode.el
(defun markdown-fontify-reference-links (last)
  "Add text properties to next reference link from point to LAST."
  (when (markdown-match-generic-links last t)
    (let* ((link-start (match-beginning 3))
           (link-end (match-end 3))
           (ref-start (match-beginning 6))
           (ref-end (match-end 6))
           ;; Link properties
           (lp (list 'keymap markdown-mode-mouse-map
                     'font-lock-multiline t
                     'help-echo (lambda (_ __ pos)
                                  (save-match-data
                                    (save-excursion
                                      (goto-char pos)
                                      (or (markdown-link-url)
                                          "Undefined reference"))))))
           ;; URL composition character
           (url-char (markdown--first-displayable markdown-url-compose-char))
           ;; Reference properties
           (rp (list 'invisible 'markdown-markup
                     'font-lock-multiline t)))
      (when markdown-mouse-follow-link
        (setq lp (append lp '(mouse-face markdown-highlight-face))))
      (dolist (g '(1 2 4 5 8))
        (when (match-end g)
          (add-text-properties (match-beginning g) (match-end g) markdown--markup-props)
          (add-face-text-property (match-beginning g) (match-end g) 'markdown-markup-face)))
      (when link-start
        (add-text-properties link-start link-end lp)
        (add-face-text-property link-start link-end 'markdown-link-face))
      (when ref-start
        (add-text-properties ref-start ref-end rp)
        (add-face-text-property ref-start ref-end 'markdown-reference-face)
        (when (and markdown-hide-urls (> (- ref-end ref-start) 2))
          (compose-region ref-start ref-end url-char)))
      t)))