Function: markdown-imenu-create-flat-index
markdown-imenu-create-flat-index is a byte-compiled function defined
in markdown-mode.el.
Signature
(markdown-imenu-create-flat-index)
Documentation
Create and return a flat imenu index alist for the current buffer.
See imenu-create-index-function and imenu--index-alist for details.
Source Code
;; Defined in ~/.emacs.d/elpa/markdown-mode-20260321.143/markdown-mode.el
(defun markdown-imenu-create-flat-index ()
"Create and return a flat imenu index alist for the current buffer.
See `imenu-create-index-function' and `imenu--index-alist' for details."
(let* ((empty-heading "-") index heading pos)
(save-excursion
;; Headings
(goto-char (point-min))
(while (re-search-forward markdown-regex-header (point-max) t)
(when (and (not (markdown-code-block-at-point-p (line-beginning-position)))
(not (markdown-text-property-at-point 'markdown-yaml-metadata-begin)))
(cond
((setq heading (match-string-no-properties 1))
(setq pos (match-beginning 1)))
((setq heading (match-string-no-properties 5))
(setq pos (match-beginning 4))))
(or (> (length heading) 0)
(setq heading empty-heading))
(setq index (append index (list (cons heading pos))))))
;; Footnotes
(when markdown-add-footnotes-to-imenu
(nconc index (markdown-get-defined-footnotes)))
index)))