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

table of contents sometimes missing first heading tag #1305

Closed
thescientist13 opened this issue Nov 8, 2024 · 0 comments · Fixed by #1306
Closed

table of contents sometimes missing first heading tag #1305

thescientist13 opened this issue Nov 8, 2024 · 0 comments · Fixed by #1306
Labels
Milestone

Comments

@thescientist13
Copy link
Member

Type of Change

Bug

Summary

Observed in ProjectEvergreen/www.greenwoodjs.dev#129 that on this page, the first table of contents header was missing 🫨
Screenshot 2024-11-08 at 1 45 38 PM

Details

This was actually something I noticed in a previous set of patches when working on the website but looks like I forget to carry it over. The main issue being that for some reason we are just (seemingly) arbitrarily calling shift with no arguments?
https://github.com/ProjectEvergreen/greenwood/blob/v0.30.0/packages/cli/src/lifecycles/graph.js#L233

// parse markdown for table of contents and output to json
customData.tableOfContents = toc(fileContents).json;
customData.tableOfContents.shift();

// parse table of contents for only the pages user wants linked
if (customData.tableOfContents.length > 0 && customData.tocHeading > 0) {
  customData.tableOfContents = customData.tableOfContents
   .filter((item) => item.lvl === customData.tocHeading);

Seems like it has always been there and is causing some sort of race condition / unexpected behaviors, and I cannot for the life of me think of why it should be that way.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
No open projects
Development

Successfully merging a pull request may close this issue.

1 participant