Function: markdown-ts--fontify-autolink

markdown-ts--fontify-autolink is a byte-compiled function defined in markdown-ts-mode.el.gz.

Signature

(markdown-ts--fontify-autolink NODE OVERRIDE START END &rest _)

Documentation

Fontify autolink NODE (URI or email) as a clickable button.

For email autolinks, the URL is prefixed with "mailto:". Angle bracket delimiters are hidden when markup is hidden. OVERRIDE, START, and END are passed through to treesit-fontify-with-override.

Source Code

;; Defined in /usr/src/emacs/lisp/textmodes/markdown-ts-mode.el.gz
(defun markdown-ts--fontify-autolink (node override start end &rest _)
  "Fontify autolink NODE (URI or email) as a clickable button.
For email autolinks, the URL is prefixed with \"mailto:\".
Angle bracket delimiters are hidden when markup is hidden.
OVERRIDE, START, and END are passed through to
`treesit-fontify-with-override'."
  (let* ((node-start (treesit-node-start node))
         (node-end (treesit-node-end node))
         (inner (buffer-substring-no-properties
                 (1+ node-start) (1- node-end)))
         (url (if (string= (treesit-node-type node) "email_autolink")
                  (concat "mailto:" inner)
                inner)))
    (treesit-fontify-with-override
     node-start node-end 'markdown-ts-link override start end)
    (markdown-ts--make-link-button node-start node-end url)
    (when markdown-ts-hide-markup
      (put-text-property node-start (1+ node-start)
                         'invisible 'markdown-ts--markup)
      (put-text-property (1- node-end) node-end
                         'invisible 'markdown-ts--markup))))