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

Retain most HTML elements in heading label in Table of Contents #164

Merged
merged 1 commit into from
Apr 7, 2022

Conversation

seshrs
Copy link
Member

@seshrs seshrs commented Apr 7, 2022

Context

Fixes #160.

Here's how we generated heading labels in the Table of Contents before this PR: If a heading contained multiple HTML elements (for instance, formatting), we ignored most of those elements and only used text nodes and codeblocks. However, this was a mistake — @marcus-darden pointed out that headings can have italics and other formatting.

This PR updates the heading-label generation logic to preserve almost all formatting within headings (except for the AnchorJS link).

Validation

I updated the "Install the dependencies" heading in the Project 0 demo spec (index.md). Visit the preview URL and observe the label in the sidebar.

Preview URL: https://preview.sesh.rs/previews/eecs485staff/primer-spec/164/

BeforeAfter
image image

Thanks for reporting @marcus-darden!

@seshrs seshrs added the semver/patch Pull Request proposes "patch" change label Apr 7, 2022
@seshrs seshrs added this to the SP/SU 22 milestone Apr 7, 2022
@github-actions
Copy link
Contributor

github-actions bot commented Apr 7, 2022

The spec from this PR is available at https://preview.sesh.rs/previews/eecs485staff/primer-spec/164/.

(Available until Sat May 07 2022.)

@seshrs seshrs marked this pull request as ready for review April 7, 2022 05:33
@seshrs seshrs merged commit 8b78a54 into develop Apr 7, 2022
@seshrs seshrs deleted the italic-headings branch April 7, 2022 05:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
semver/patch Pull Request proposes "patch" change
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant