Function: markdown-fontify-wiki-links

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

Signature

(markdown-fontify-wiki-links LAST)

Documentation

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

Source Code

;; Defined in ~/.emacs.d/elpa/markdown-mode-20260321.143/markdown-mode.el
(defun markdown-fontify-wiki-links (last)
  "Add text properties to next wiki link from point to LAST."
  (when (and markdown-enable-wiki-links
             (markdown-match-inline-generic markdown-regex-wiki-link last))
    (let* ((begin (match-beginning 1))
           (end (match-end 1))
           (beg2 (match-beginning 2))
           (end2 (match-end 2))
           (beg3 (match-beginning 3))
           (end3 (match-end 3))
           (beg4 (match-beginning 4))
           (end4 (match-end 4))
           (beg5 (match-beginning 5))
           (end5 (match-end 5))
           (beg6 (match-beginning 6))
           (end6 (match-end 6))
           (part1 (match-string-no-properties 3))
           (part2 (match-string-no-properties 5))
           (aliasp (string-equal (match-string-no-properties 4) "|"))
           (file-name (markdown-convert-wiki-link-to-filename (markdown-wiki-link-link)))
           (file-missing-p (not (file-exists-p file-name))))
      (if (or (markdown-in-comment-p begin)
              (markdown-in-comment-p end)
              (markdown-inline-code-at-pos-p begin)
              (markdown-inline-code-at-pos-p end)
              (markdown-code-block-at-pos begin))
          (progn (goto-char (min (1+ begin) last))
                 (when (< (point) last)
                   (markdown-fontify-wiki-links last)))
        ;; Add text properties for hiding markup
        (progn
          ;; Propertize opening and closing brackets
          (add-text-properties    beg2 end2 markdown--markup-props)
          (add-face-text-property beg2 end2 'markdown-markup-face)
          (add-text-properties    beg6 end6 markdown--markup-props)
          (add-face-text-property beg6 end6 'markdown-markup-face)
          (if aliasp
              (progn
                ;; Propertize pipe separating URL from link text
                (add-text-properties    beg4 end4 markdown--markup-props)
                (add-face-text-property beg4 end4 'markdown-markup-face)
                (if markdown-wiki-link-alias-first
                    (progn
                      ;; Properties alias portion of link
                      (add-text-properties    beg3 end3 (markdown--link-props part2))
                      (add-face-text-property beg3 end3 'markdown-link-face)
                      (add-text-properties    beg5 end5 (markdown--url-props))
                      (add-text-properties    beg5 end5 '(invisible markdown-markup))
                      (add-face-text-property beg5 end5 'markdown-url-face)
                      (when (and file-missing-p markdown-wiki-link-fontify-missing)
                        (put-text-property beg3 end3 'face 'markdown-missing-link-face)))
                  (progn
                    ;; Properties URL portion of link
                    (add-text-properties    beg3 end3 (markdown--url-props))
                    (add-text-properties    beg3 end3 '(invisible markdown-markup))
                    (add-face-text-property beg3 end3 'markdown-url-face)
                    (add-text-properties    beg5 end5 (markdown--link-props part1))
                    (add-face-text-property beg5 end5 'markdown-link-face)
                    (when (and file-missing-p markdown-wiki-link-fontify-missing)
                      (put-text-property beg5 end5 'face 'markdown-missing-link-face)))))
            (progn
              ;; Properties link as link text
              (add-text-properties    beg3 end3 (markdown--link-props part1))
              (add-face-text-property beg3 end3 'markdown-link-face)
              (when (and file-missing-p markdown-wiki-link-fontify-missing)
                (put-text-property beg3 end3 'face 'markdown-missing-link-face)))))
        (set-match-data (list begin end))
        t))))