Function: markdown-reference-find-links
markdown-reference-find-links is a byte-compiled function defined in
markdown-mode.el.
Signature
(markdown-reference-find-links REFERENCE)
Documentation
Return a list of all links for REFERENCE.
REFERENCE should not include the surrounding square brackets. Elements of the list have the form (text start line), where text is the link text, start is the location at the beginning of the link, and line is the line number on which the link appears.
Source Code
;; Defined in ~/.emacs.d/elpa/markdown-mode-20260321.143/markdown-mode.el
(defun markdown-reference-find-links (reference)
"Return a list of all links for REFERENCE.
REFERENCE should not include the surrounding square brackets.
Elements of the list have the form (text start line), where
text is the link text, start is the location at the beginning of
the link, and line is the line number on which the link appears."
(let* ((ref-quote (regexp-quote reference))
(regexp (format "!?\\(?:\\[\\(%s\\)\\][ ]?\\[\\]\\|\\[\\([^]]+?\\)\\][ ]?\\[%s\\]\\)"
ref-quote ref-quote))
links)
(save-excursion
(goto-char (point-min))
(while (re-search-forward regexp nil t)
(let* ((text (or (match-string-no-properties 1)
(match-string-no-properties 2)))
(start (match-beginning 0))
(line (markdown-line-number-at-pos)))
(cl-pushnew (list text start line) links :test #'equal))))
links))