Skip to content

Fix live sample IDs for CSS docs #7732

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

Merged
merged 1 commit into from
Aug 9, 2021

Conversation

wbamberg
Copy link
Collaborator

@wbamberg wbamberg commented Aug 9, 2021

This is part of #5865.

On MDN, live samples (the EmbedLiveSample macro) are passed an ID that Yari uses to find the code to include in the sample. These IDs typically (almost always, in Markdown-land) refer to headings.

In HTML, we can have explicit id attributes for headings, that can differ from the ID that would be auto-generated from the heading's text. Live samples can then use these "custom" IDs to refer to the scope where Yari can find the code.

In Markdown we can't do that - IDs are always generated from the heading text. So if a live sample in the old HTML system was using a custom ID, this will cause an error when we convert to Markdown.

I've checked through the CSS docs to find pages where this was happening - effectively where a live sample was using an ID that differed from the one that would be generated by Yari's slugify function. In this PR I've fixed all the macro calls to use the auto-generated form.

To make it easier to check that this is working, I've deleted the explicit id attribute in all affected files, so all EmbedLiveSample calls will need to use an ID that matches the generated one. Note that in some cases here the macro was already using that form, so I just deleted the id in the heading. In other cases I've correspondingly adjusted the macro argument.

@wbamberg wbamberg requested a review from a team as a code owner August 9, 2021 04:48
@wbamberg wbamberg requested review from mirunacurtean and removed request for a team August 9, 2021 04:48
@github-actions

This comment has been minimized.

@sideshowbarker sideshowbarker merged commit 6848954 into mdn:main Aug 9, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 9, 2022
@wbamberg wbamberg deleted the fix-css-live-sample-ids branch October 15, 2022 17:23
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants