Skip to content

fix: be more robust about finding sections #340

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

Closed
wants to merge 1 commit into from
Closed

Conversation

dummdidumm
Copy link
Member

#322 and #331 added pages for compiler/runtime errors/warnings, but these pages are barely usable because "On this page" is empty because of missing h2 tags.

This fixes that by enhancing our sections logic: If no h2 tags are found, try again with h3 tags.

#322 and #331 added pages for compiler/runtime errors/warnings, but these pages are barely usable because "On this page" is empty because of missing h2 tags.

This fixes that by enhancing our sections logic: If no h2 tags are found, try again with h3 tags.
Copy link

vercel bot commented Oct 11, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
omnisite ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 11, 2024 1:10pm

@Rich-Harris
Copy link
Member

I'm 👎 on this. It makes things inconsistent (why would these headers appear on the compiler errors/warnings pages but not the runtime errors/warnings pages? from the outside that makes no sense) and I don't think it really aligns with how people will use these pages in practice, which is to say they'll end up here by clicking a link from a warning or an error, which will take them to the exact right spot. It's not something to idly peruse.

If people are looking for something specific for some reason, then a) Ctrl-F works, and b) we should probably add h3s to the search index

@dummdidumm
Copy link
Member Author

You can't deny that "on this page" looks super silly on them right now. I also didn't realize that there was additional h2 headings added to those generated pages - I would just remove that. It has no value and would resolve the inconsistency.

@Rich-Harris
Copy link
Member

There are other pages that also have an empty 'on this page', including the very first page of the docs. If we think that looks unacceptably silly then we need a more general solution. I prefer that form of silliness to a long ugly sidebar, honestly.

We could always group stuff by category (a11y, script, template etc).

It has no value

Disagree, I think it's helpful to understand that some runtime errors will only appear in your browser devtools while others may appear in your terminal. Also, we'd have to do some more munging to preserve the alphabetical order if we put everything in one giant list

@dummdidumm
Copy link
Member Author

There are other pages that also have an empty 'on this page

That's fine as long as the page itself isn't a mile long.

We could always group stuff by category (a11y, script, template etc)

If there's a good way to have more fine grained grouping then yes. But I'm not sure what good names for these are, and how to categorize them. The separation into script/style/template we have is very technical, I'm not sure that helps users.

Either way if this is something you don't agree on then let's just punt on this right now, there are more pressing matters.

@Rich-Harris
Copy link
Member

punting :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants