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

Markdown table of contents doesn't handle YAML frontmatter #14200

Closed
bollwyvl opened this issue Mar 15, 2023 · 2 comments · Fixed by #14203
Closed

Markdown table of contents doesn't handle YAML frontmatter #14200

bollwyvl opened this issue Mar 15, 2023 · 2 comments · Fixed by #14203
Assignees
Milestone

Comments

@bollwyvl
Copy link
Contributor

Description

When editing a Markdown document with YAML front-matter, the Table of Contents shows only the last item of frontmatter.

image

Reproduce

  • Open the Launcher

  • Click on Markdown File

  • Open the Table of Contents sidebar

  • Add a header

    # Hello World
  • See Hello World in the Table of Contents

  • Add some YAML front matter before the header

    ---
    foo: bar
    boo: baz
    ---
    
    # Hello World
  • See only boo: baz in the Table of Contents

This was found while working on a JEP in JupyterLab.

By adding a newline above the second ---, the problem also goes away, so presumably it's treating that last item as an h2 which counterfeits everything below it.

Expected behavior

  • Definitely see all the headers
  • Maybe see a collapsible table above/below the rest of the items
    • but definitely not worth adding/faking a YAML parser
    • maybe just a chunk of YAML-formatted code (e.g. if the first line starts with [^:]+:

Context

@bollwyvl bollwyvl added bug status:Needs Triage Applied to new issues that need triage labels Mar 15, 2023
@fcollonval fcollonval added this to the 4.0.0 milestone Mar 15, 2023
@JasonWeill
Copy link
Contributor

Does this happen with 3.6.x or older versions of JupyterLab? Is this a regression?

@bollwyvl
Copy link
Contributor Author

bollwyvl commented Mar 20, 2023 via email

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 21, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants