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

Improvement: A user should be able to exclude headings from the ToC block in the editor. #69200

Open
gmovr opened this issue Feb 14, 2025 · 1 comment
Labels
[Block] Table of contents (experimental) Affects the Table of contents Block [Type] Enhancement A suggestion for improvement.

Comments

@gmovr
Copy link

gmovr commented Feb 14, 2025

What problem does this address?

In the ToC block, there is currently no way to exclude a specific heading from the list. I'm aware of two workarounds, but neither is good, and they both have drawbacks:

  • Using a span or non-heading element to render a heading. This is not semantically correct and could also impact SEO
  • Converting the ToC to a static list. This presents another issue, e.g., if new headings are added or the IDs change, the ToC will be out of sync.

One use case would be very long articles, meaning a long ToC. However, I can also see this feature being useful for cases where a heading is not "ToC worthy" but we still want to retain the article's semantic hierarchy.

What is your proposed solution?

I've outlined a solution in #69063, but after discussing it briefly with @swissspidy, I realized it seems a bit out of scope for the current PR. Also, I think more discussion on the specific UI could be helpful.

My solution relies on a class assigned to the heading, which is simple but also opaque if you don't read the code.

I will remove this functionality from #69063 to align it with the scope of #51605 and open a new PR with my suggestion to exclude headings to cover the issue you're reading now.

@gmovr gmovr added the [Type] Enhancement A suggestion for improvement. label Feb 14, 2025
@t-hamano t-hamano added the [Block] Table of contents (experimental) Affects the Table of contents Block label Feb 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] Table of contents (experimental) Affects the Table of contents Block [Type] Enhancement A suggestion for improvement.
Projects
None yet
Development

No branches or pull requests

3 participants