Function: markdown-get-defined-footnotes
markdown-get-defined-footnotes is a byte-compiled function defined in
markdown-mode.el.
Signature
(markdown-get-defined-footnotes)
Documentation
Return a list of all defined footnotes.
Result is an alist of pairs (MARKER . LINE), where MARKER is the footnote marker, a string, and LINE is the line number containing the footnote definition.
For example, suppose the following footnotes are defined at positions
448 and 475:
[^1]: First footnote here.
[^marker]: Second footnote.
Then the returned list is: (("^1" . 478) ("^marker" . 475))
Source Code
;; Defined in ~/.emacs.d/elpa/markdown-mode-20260321.143/markdown-mode.el
(defun markdown-get-defined-footnotes ()
"Return a list of all defined footnotes.
Result is an alist of pairs (MARKER . LINE), where MARKER is the
footnote marker, a string, and LINE is the line number containing
the footnote definition.
For example, suppose the following footnotes are defined at positions
448 and 475:
\[^1]: First footnote here.
\[^marker]: Second footnote.
Then the returned list is: ((\"^1\" . 478) (\"^marker\" . 475))"
(save-excursion
(goto-char (point-min))
(let (footnotes)
(while (markdown-search-until-condition
(lambda () (and (not (markdown-code-block-at-point-p))
(not (markdown-inline-code-at-point-p))
(not (markdown-in-comment-p))))
markdown-regex-footnote-definition nil t)
(let ((marker (match-string-no-properties 1))
(pos (match-beginning 0)))
(unless (zerop (length marker))
(cl-pushnew (cons marker pos) footnotes :test #'equal))))
(reverse footnotes))))