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

Don't assume that a document has an h1 #15

Open
Wilfred opened this issue Dec 12, 2015 · 3 comments
Open

Don't assume that a document has an h1 #15

Wilfred opened this issue Dec 12, 2015 · 3 comments

Comments

@Wilfred
Copy link
Contributor

Wilfred commented Dec 12, 2015

Given the markdown:

## foo

### bar

markdown-toc produces:

<!-- markdown-toc start - Don't edit this section. Run M-x markdown-toc-generate-toc again -->
**Table of Contents**

- [-](#-)
    - [bar](#bar)

<!-- markdown-toc end -->
@ardumont
Copy link
Owner

Hello, sorry for the delay.

Indeed.

@ardumont
Copy link
Owner

ardumont commented Dec 22, 2015

Well,

just to let you know, the problem is upstream...

The data-structure, created by the function markdown-imenu-create-index (from
markdown-mode), when not "respected" is then not well-formed...

I tried something around it [1]

Not yet working... The levels are still messed up and i have no way to
determine the levels correctly from this data-structure without reparsing
myself the buffer.

So i guess, the only way is to try and improve [2]

Or to override imenu-create-index-function (whose value is the function
markdown-imenu-create-index that I use to extract a beginning of toc) with
one that is ok regarding this use case.

But, I'm nowhere near having time to yet.

[1] https://github.com/ardumont/markdown-toc/blob/improve-strange-markdown-dealing/markdown-toc.el#L92

[2] https://github.com/jrblevin/markdown-mode/blob/master/markdown-mode.el#L4014

Cheers,

@wesnel
Copy link

wesnel commented Nov 13, 2023

hi, is this still an issue? i cannot recreate this issue on my end:

## foo

### bar

<!-- markdown-toc start - Don't edit this section. Run M-x markdown-toc-refresh-toc -->
**Table of Contents**

- [foo](#foo)
    - [bar](#bar)

<!-- markdown-toc end -->

i think the upstream issue may have been fixed. i am using markdown-mode version 2.6-alpha and markdown-toc version 0.1.5.

maybe the fix was in jrblevin/markdown-mode#574? i'm not sure.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants