Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature: imenu index #59

Open
VladimirAlexiev opened this issue Nov 21, 2024 · 0 comments
Open

feature: imenu index #59

VladimirAlexiev opened this issue Nov 21, 2024 · 0 comments

Comments

@VladimirAlexiev
Copy link

imenu is an interactive "table of contents" of a document. It's very useful for large docs.
Here's how it looks for a markdown doc (the window on the right):
image

To grok those dots, for comparison here's a generated TOC for the same file:
image

Looking at https://jblevins.org/projects/markdown-mode/ , you just need to define 1-2 functions:

(defun markdown-imenu-create-nested-index ()
(defun markdown-imenu-create-flat-index ()

And then in markdown-mode:

  (setq imenu-create-index-function
        (if markdown-nested-imenu-heading-index
            #'markdown-imenu-create-nested-index
          #'markdown-imenu-create-flat-index))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant