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

Markdownlint: Markdownlint and TOP web app generate different heading IDs/fragments #28328

Open
3 of 9 tasks
MaoShizhong opened this issue Jul 2, 2024 · 0 comments · May be fixed by #28330
Open
3 of 9 tasks

Markdownlint: Markdownlint and TOP web app generate different heading IDs/fragments #28328

MaoShizhong opened this issue Jul 2, 2024 · 0 comments · May be fixed by #28330
Assignees
Labels
Content: Markdownlint Involves anything related to the curriculum repo linter

Comments

@MaoShizhong
Copy link
Contributor

MaoShizhong commented Jul 2, 2024

Checks

Describe your suggestion

Markdownlint's TOP051 rule (valid link fragments) uses GitHub's heading algorithm for generating link fragments from headings. This preserves dashes, so a heading like ### Title - Subtitle will generate title---subtitle.

TOP's web app's id/fragment generation removes these isolated dashes, so the above will become foo-bar. #title---subtitle will not scroll to the correct heading on our website but #title-subtitle will, except Markdownlint will flag #title-subtitle as an invalid link fragment as it expects #title---subtitle instead. This situation occurred recently in #28327.

A solution would be to replace dashes surrounded by spaces (so hyphenated words are preserved) with a colon and single space, since both serve to separate "parts" of a heading.

i.e. ### Title - subtitle should be fixable to ### Title: Subtitle.

Acceptance criteria

  • New markdownlint rule flags any level headings if they contain SPACE DASH SPACE, and suggest the colon equivalent in the error message
  • Fix info should convert the heading to the colon equivalent
  • Dashes used to hyphenate words must be left alone
  • Test .md file should demonstrate all reasonable positive and negative cases
  • The rule should have an appropriate doc file
  • Rule added to .markdownlint-cli2.jsonc config file custom rules array

Path

Other / NA

Lesson Url

N/A

(Optional) Discord Name

No response

(Optional) Additional Comments

No response

@MaoShizhong MaoShizhong self-assigned this Jul 2, 2024
@MaoShizhong MaoShizhong added the Content: Markdownlint Involves anything related to the curriculum repo linter label Jul 2, 2024
@MaoShizhong MaoShizhong linked a pull request Jul 2, 2024 that will close this issue
7 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Content: Markdownlint Involves anything related to the curriculum repo linter
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant