Skip to content

Headings inside components are not in the table of contents #1235

@st3phhays

Description

@st3phhays

What You Are Seeing?

If a heading is inside of a component and imported into an .mdx file, that heading does not appear in the table of contents for the page.

What is Expected?

Unfortunately, this is working as designed. Astro does not natively support this. Thinking about this issue more, headings should not be inside of components at all. A big reason for this is that the heading level may be different based on the content of the page. Using the wrong heading level will hurt accessibility.

It has been decided that instead of placing headings inside of components, all heading should be in the original .mdx file, and only the content be pulled into a component. This will give us:

  1. Control over the heading levels.
  2. It will automatically be added to the TOC like other headings.

How Did You Get This To Happen? (Steps to Reproduce)

  1. Go to https://docs.chocolatey.org/en-us/licensed-extension/compatibility/
  2. Notice the heading "Chocolatey Component Package Dependencies" is not in the right side TOC.

Metadata

Metadata

Assignees

No one assigned

    Labels

    0 - BacklogIssue is accepted, but is not ready to be worked on or not in current sprint.EnhancementIssues that introduce new functionality to the project, or enhances/updates existing functionality.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions