Skip to content

Add support for explicit id attributes of headings#162

Merged
sebastianbenz merged 1 commit intomainfrom
unknown repository
Jan 10, 2022
Merged

Add support for explicit id attributes of headings#162
sebastianbenz merged 1 commit intomainfrom
unknown repository

Conversation

@ilyaspiridonov
Copy link
Contributor

@ilyaspiridonov ilyaspiridonov commented Jan 8, 2022

Heading ids are currently generated based on the heading text. As a result, in translated documents headings are not cross-referenced correctly. In the below example the button will link to an incorrect anchor: https://bentojs.dev/de/components/bento-accordion/#web-component

Screenshot 2022-01-08 at 18 25 10

This PR adds support for explicitly setting the id attribute of headings in the Markdown documents to keep them consistent across translations.


This implementation is the same as the one used in the web.dev project: https://github.com/GoogleChrome/web.dev/blob/main/src/site/_plugins/markdown.js

In future, English documentation would need to include explicit IDs for the headings that are cross-referenced in the doc.

@ilyaspiridonov
Copy link
Contributor Author

@patrickkettner FYI

Copy link
Collaborator

@sebastianbenz sebastianbenz left a comment

Choose a reason for hiding this comment

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

Looks good - thanks!

@sebastianbenz sebastianbenz merged commit 7764e3c into ampproject:main Jan 10, 2022
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.

3 participants