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

ToC is generated out of order #22

Open
alex-okrushko opened this issue Jan 17, 2021 · 6 comments
Open

ToC is generated out of order #22

alex-okrushko opened this issue Jan 17, 2021 · 6 comments

Comments

@alex-okrushko
Copy link

Say, I have the following HTML:

<h1>Style Guide</h1>
  <h2 id="a">a</h2>
    <h3 id="aa">aa</h3>
    <p>aa foo bar</p>
       <h4 id="aaa">aaa</h4>
       <p>blah blah</p>
  <h2 id="b">b</h2>
  <p>bbb</p>
  <h2 id="c">c</h2>
    <h3 id="cc">cc</h3>
    <p>cc cc cc</p>

The generated ToC puts cc h3 into the first a group, instead of putting it under c group:

Screen Shot 2021-01-17 at 10 51 49 AM

@alex-okrushko
Copy link
Author

Looks like @JordanShurmer fixed it in https://github.com/JordanShurmer/eleventy-plugin-toc and released the plugin under eleventy-plugin-nesting-toc.

Maybe let's merge the fixes and keep one ToC plugin?

Thank you

@JordanShurmer
Copy link

I ended up basically rewriting the whole thing, so mine isn't really much of a fork of this anymore. Plus things have changed quite a bit since my initial fork. So.. I'm not sure merging my fork would be feasible nor desirable .

Probably far better to submit a new PR against this project adding the proper nesting logic.

@alex-okrushko
Copy link
Author

@JordanShurmer I ended up using your eleventy-plugin-nesting-toc: https://github.com/ts-dev-inc/ts.dev

I noticed that it was a rewrite, and I like how you structured it.

@netmikey I'd suggest to use eleventy-plugin-nesting-toc as well.

@netmikey
Copy link

@JordanShurmer Would you mind enabling Github issues on your fork? Cause #21 exists on your rewrite too ;-)

@JordanShurmer
Copy link

@netmikey Yes

JordanShurmer#4

@jdsteinbach
Copy link
Owner

@alex-okrushko Can you provide a reduced test case, including Eleventy version, templating language, plugin version, etc?

I just test with your sample markup in a clean Eleventy install and the TOC was rendered with the headings in the correct order.

Thanks!

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

4 participants