Skip to content

Conversation

theletterf
Copy link
Contributor

@theletterf theletterf commented Jun 30, 2025

This PR updates the Stepper component so that:

  • Step titles are rendered as an <Hn> heading, where n is the level of the preceding heading + 1.
  • Heading thus appear in the table of content if they're of level 3.
  • Step titles are not included in the ToC if they're nested inside another directive to avoid weird situations, such as competing headings in tabs using steppers and headings hidden inside a dropdown. Strange, but could happen.

Fixes #1464

Example of dynamic headings (h4 after an h3)

headings

Example of H3 step titles appearing in ToC

Screenshot 2025-06-30 at 10 57 55

@theletterf theletterf requested review from a team as code owners June 30, 2025 09:10
@theletterf theletterf self-assigned this Jun 30, 2025
Comment on lines +291 to +292
.Descendants<DirectiveBlock>()
.OfType<StepBlock>()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Wondering if this can be just .Descendants<StepBlock>()

@reakaleek
Copy link
Member

Wondering if we also need to adapt the styling. Like adjust the size of the step number depending on the h-tag level. 🤷

@theletterf
Copy link
Contributor Author

@reakaleek Good point. For now I would keep the number size the same.

@theletterf theletterf merged commit af67fed into main Jun 30, 2025
16 checks passed
@theletterf theletterf deleted the add-semantic-steps-stepper branch June 30, 2025 09:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feature Request]: Automatically add anchors to stepper items, and add them to the ToC
2 participants