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

Visually differentiate table of content heading levels #7385

Merged
merged 2 commits into from
Jan 6, 2025

Conversation

bmuenzenmeyer
Copy link
Collaborator

Description

Previous attempts to fix this did not use head.depth. My quick looks at the code made it seem that this data was not available, but luckily it is! I should have known, because we constrain the headings we show already (omitting h1, h5, and h6).

Finding this out was as quick as relaying it to contributors to fix - so I added a story and tests for visibility.

Validation

Here's a before (left) and after (right) from a recently published Learn article

image

Note the component wraps fine on smaller viewports

image

See the preview.

Related Issues

fixes #7275

Check List

  • I have read the Contributing Guidelines and made commit messages that follow the guideline.
  • I have run npm run format to ensure the code follows the style guide.
  • I have run npm run test to check if all tests are passing.
  • I have run npx turbo build to check if the website builds without errors.
  • I've covered new added functionality with unit tests if necessary.

@Copilot Copilot bot review requested due to automatic review settings January 3, 2025 13:54
@bmuenzenmeyer bmuenzenmeyer requested a review from a team as a code owner January 3, 2025 13:54
Copy link

vercel bot commented Jan 3, 2025

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

Name Status Preview Updated (UTC)
nodejs-org ✅ Ready (Inspect) Visit Preview Jan 3, 2025 1:54pm

Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

Copy link
Contributor

github-actions bot commented Jan 3, 2025

Lighthouse Results

URL Performance Accessibility Best Practices SEO Report
/en 🟢 100 🟢 100 🟢 100 🟢 91 🔗
/en/about 🟢 100 🟢 100 🟢 100 🟢 91 🔗
/en/about/previous-releases 🟢 99 🟢 100 🟢 100 🟢 92 🔗
/en/download 🟢 97 🟢 100 🟢 100 🟢 91 🔗
/en/blog 🟢 100 🟢 100 🟢 96 🟢 92 🔗

Copy link
Contributor

github-actions bot commented Jan 3, 2025

Unit Test Coverage Report

Lines Statements Branches Functions
Coverage: 85%
83.91% (600/715) 65.39% (189/289) 82.01% (114/139)

Unit Test Report

Tests Skipped Failures Errors Time
124 0 💤 0 ❌ 0 🔥 4.983s ⏱️

Copy link
Member

@ovflowd ovflowd left a comment

Choose a reason for hiding this comment

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

SGTM

Copy link
Member

@AugustinMauroy AugustinMauroy left a comment

Choose a reason for hiding this comment

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

LGMT !

Copy link
Member

@canerakdas canerakdas left a comment

Choose a reason for hiding this comment

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

LGTM!

@bmuenzenmeyer bmuenzenmeyer added this pull request to the merge queue Jan 6, 2025
Merged via the queue into main with commit 6093af9 Jan 6, 2025
16 checks passed
@bmuenzenmeyer bmuenzenmeyer deleted the 7275-toc-headings branch January 6, 2025 15:05
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.

Visually differentiate H2 from H3 headings in Metabar Table of Contents
4 participants