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 - Allow Users to Select Which Heading Levels Will Be Included #51605

Open
jodamo5 opened this issue Jun 17, 2023 · 4 comments · May be fixed by #69063
Open

Table of Contents - Allow Users to Select Which Heading Levels Will Be Included #51605

jodamo5 opened this issue Jun 17, 2023 · 4 comments · May be fixed by #69063
Labels
[Block] Table of contents (experimental) Affects the Table of contents Block Needs Design Needs design efforts. [Status] In Progress Tracking issues with work in progress [Type] Enhancement A suggestion for improvement.

Comments

@jodamo5
Copy link
Contributor

jodamo5 commented Jun 17, 2023

What problem does this address?

Currently, the Table of Contents block inserts a link for all headings it finds in the post. However, if there are a lot of headings in the post, and if the author has used a combination of H1, H2, H3, H4, H5, H6 headings, etc, then the Table of Contents can be undesirably long.

What is your proposed solution?

The settings of the block should allow editors to select which heading levels will be included in the Table of Contents block.

I think the simplest option would be that users can choose the lowest level of heading that should be included in the TOC. It would be a single drop-down of the 6 heading levels. If a user chooses H3, then only H1, H2 and H3 headings will be included in the TOC. If they chose H6 then all heading levels will be included in the TOC.

@t-hamano t-hamano added [Type] Enhancement A suggestion for improvement. [Block] Table of contents (experimental) Affects the Table of contents Block labels Jun 19, 2023
@JosVelasco
Copy link

I like your proposed solution, @jodamo5.

An alternative I'd like to see is having the list collapse by default as Wikipedia does.

@Mamaduka Mamaduka added the Needs Design Needs design efforts. label Sep 14, 2023
@Mamaduka
Copy link
Member

@richtabor, @jasmussen, I would appreciate any recommendation here from a design perspective.

@jasmussen
Copy link
Contributor

jasmussen commented Sep 14, 2023

This seems like a valid option to build into the inspector, where there's plenty of room.

I would also tend to agree that the dropdown proposed, defaulting to showing all heading levels, would likely be the best simplest interface; this is presuming we will always want to show H1s if available. We definitely want to avoid a checkbox system where you can show only H2s and H4s, for example.

One question would be whether it's a toggle, on by default, with the label "Show all heading levels", and when untoggled it surfaces the dropdown below. Or whether the dropdown can stand on its own.

The other is what labels to show, "Lowest level" isn't that clear to me. To get the conversation started, perhaps:

Heading levels
[Show all heading levels ▾]
Select which heading levels to show.

— with dropdown options:

Show all heading levels *
Headings 1 and 2
Headings 1 to 3
Headings 1 to 4
Headings 1 to 5
Headings 1 to 6 
  • default.

Mainly it would be good to avoid the HTML markup "H1", "H2" terminology, as that likely won't resonate with a majority of people.

@Mamaduka
Copy link
Member

Thank you, Joen!

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 Needs Design Needs design efforts. [Status] In Progress Tracking issues with work in progress [Type] Enhancement A suggestion for improvement.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants