Function: markdown-ts--fontify-link-ref-label
markdown-ts--fontify-link-ref-label is a byte-compiled function
defined in markdown-ts-mode.el.gz.
Signature
(markdown-ts--fontify-link-ref-label NODE OVERRIDE START END &rest _)
Documentation
Fontify link reference definition label NODE as a clickable button.
The brackets and colon 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-link-ref-label (node override start end &rest _)
"Fontify link reference definition label NODE as a clickable button.
The brackets and colon 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))
(parent (treesit-node-parent node))
(dest-node (treesit-search-subtree parent "\\`link_destination\\'"))
(url (when dest-node (treesit-node-text dest-node t))))
;; Fontify the label text (inside brackets).
(treesit-fontify-with-override
(1+ node-start) (1- node-end)
'markdown-ts-link override start end)
;; Make it a clickable button.
(when url
(markdown-ts--make-link-button (1+ node-start) (1- node-end) url))
;; Hide "[" before label and "]: " between label and destination.
(when markdown-ts-hide-markup
(put-text-property node-start (1+ node-start)
'invisible 'markdown-ts--markup)
(let ((colon-end (if dest-node (treesit-node-start dest-node)
(1+ node-end))))
(put-text-property (1- node-end) colon-end
'invisible 'markdown-ts--markup)))))