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

Restore heading ids #90

Merged
merged 1 commit into from
Dec 10, 2023
Merged

Restore heading ids #90

merged 1 commit into from
Dec 10, 2023

Conversation

paulrobertlloyd
Copy link
Contributor

@paulrobertlloyd paulrobertlloyd commented Dec 10, 2023

In #89, I said (emphasis added):

In updating to a version of marked post v5, we can no longer depend on having built in support for heading ids. These can still be added separately via marked’s options in a consuming package.

Turns out, that’s not quite true. Because we are providing a renderer, this is incompatible with the marked-gfm-heading-id extension.

Enable marked-gfm-heading-id before this extension, and its ids will be removed.

Enable marked-gfm-heading-id after this extension, and our heading classes will be removed.

So let’s provide heading ids in our extension, which we can create using our own slugger. This may not be as robust as the one marked previously included (which used github-slugger under the hood), but should cater to 99.9% of use cases.

(We might have been able to use github-slugger, were it not for the fact that this package exports a Common JS module for compatibility with the GOV.UK Prototype Kit.)

@paulrobertlloyd paulrobertlloyd merged commit 2124e5f into main Dec 10, 2023
1 check passed
@paulrobertlloyd paulrobertlloyd deleted the heading-ids branch December 10, 2023 01:03
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.

1 participant