fix: hyphenate each space in integration README heading slugs - #5735
Closed
dimitrieh wants to merge 1 commit into
Closed
fix: hyphenate each space in integration README heading slugs#5735dimitrieh wants to merge 1 commit into
dimitrieh wants to merge 1 commit into
Conversation
githubSlugify collapsed runs of whitespace into a single hyphen. GitHub strips the punctuation first and then hyphenates the remaining spaces one at a time, so a heading with punctuation between two words keeps the space on either side of it and lands a double hyphen. node-red-contrib-counter's "Bugs / Feature request" is #bugs--feature-request on GitHub, its own table of contents links to that, and we generated #bugs-feature-request, so the link pointed at an id that did not exist. That is the bad anchor failing the link checker on main, and with it every table-of-contents entry a README author wrote against GitHub for a heading with punctuation in it. Headings whose words are separated by single spaces slug identically either way, which is why one anchor broke rather than hundreds. The checker's own --check-anchors run over the built integration pages is the regression guard; githubSlugify is private to a .ts util and the test script only globs .mjs libs, so there is nowhere to unit test it without restructuring.
5 tasks
Contributor
Author
|
@Yndira-E this is because of a CI failure. maybe this PR is not needed and the link needs to be just updated 🤔 |
Contributor
|
I know, I had opened a similar one, could you please review/merge that one? #5734 |
✅ Deploy Preview for flowforge-website ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Description
The link checker is failing on
mainwith one bad anchor,/integrations/node-red-contrib-counter#bugs--feature-request.githubSlugifycollapsed runs of whitespace into a single hyphen; GitHub strips the punctuation first and then hyphenates the remaining spaces one at a time, so a heading with punctuation between two words keeps the space on either side and lands a double hyphen. That README'sBugs / Feature requestis#bugs--feature-requeston GitHub and its own table of contents links to it, while we generated#bugs-feature-request.One character,
\s+to\s. It fixes every table-of-contents link a README author wrote against GitHub for a heading with punctuation in it, not just this one. Headings whose words are separated by single spaces slug identically either way, which is why one anchor broke rather than hundreds; the function's own documented example,#egm-optionalfor "EGM (optional)", is unchanged.Checked all nine of that README's anchors against the ten headings it declares: one dangling before, none after.
Related Issue(s)
Found while working on #5671, which is blocked by this failure.
Checklist
githubSlugifyis private to a.tsutil andnpm testonly globs.mjslibs, so there is nowhere to unit test it without restructuring. The checker's own--check-anchorspass over the built integration pages is the regression guard.