-
Notifications
You must be signed in to change notification settings - Fork 13.9k
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
Markdownlint: dashes-in-headings
custom rule
#28330
Markdownlint: dashes-in-headings
custom rule
#28330
Conversation
Co-authored-by: Asartea <[email protected]>
Edit: Changing the algo used for the website would probably be more disruptive by breaking any links that include fragments that would differ if we generated them using the github algorithm. So probably using this rule would be preferable. @KevinMulhern would appreciate your opinion here. Was just chatting to Eric about alternatives to implementing this rule, as I just realised this rule won't cover cases like Was just wondering that as an alternative to this rule to cover only some of the mismatches in algos, whether we could nab the Github algo (adapted as necessary) and make a custom method in Rails to replace |
#28694 highlighted another issue with the discrepancy between MD051 using GitHub's section heading algo, and our website using Closing since this PR will not be a sufficient fix - further discussion required. |
Because
Markdownlint and VSC use GitHub's heading algorithm to generate fragments, which gives different results to Ruby on Rails'
#parameterize
method when dealing with isolated dashes (a dash group surrounded by spaces, used as a separator).This leads to the TOP-valid fragment for
### Heading - Subheading
triggering the MD051 rule, and the Markdownlint-valid fragment not matching the correct heading ID.While we can use
### Heading - Subheading {#heading-subheading}
for Markdownlint and VSC to pick up, this looks messy and just gives us an extra point of failure if we change the heading but forget to change the custom ID.The solution is to enforce colons as separators, leaving other dash uses (like hyphens or CLI flags) in headings alone. Markdownlint and our web app will both convert
### Heading: Subheading and hyphenated-word
toheading-subheading-and-hyphenated-word
.This PR
Issue
Closes #28328
Additional Information
This problem was encountered in #28327
Pull Request Requirements
location of change: brief description of change
format, e.g.Intro to HTML and CSS lesson: Fix link text
Because
section summarizes the reason for this PRThis PR
section has a bullet point list describing the changes in this PRIssue
section