-
Notifications
You must be signed in to change notification settings - Fork 12.4k
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: New custom ordered list lazy numbering rule #27836
Labels
Type: Enhancement
Involves a new feature or enhancement request
Comments
MaoShizhong
added
Type: Enhancement
Involves a new feature or enhancement request
Status: Help Wanted
This issue can be assigned to other contributors
labels
Apr 22, 2024
I'm interested to take on this challenge! |
I've high hopes for you @BryanF1nes ! |
MaoShizhong
removed
the
Status: Help Wanted
This issue can be assigned to other contributors
label
Apr 22, 2024
This issue is stale because it has had no activity for the last 30 days. |
github-actions
bot
added
the
Status: Stale
This issue/PR has been inactive for over 30 days and will be closed if inactivity continues
label
May 23, 2024
github-actions
bot
removed
the
Status: Stale
This issue/PR has been inactive for over 30 days and will be closed if inactivity continues
label
May 24, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Checks
Describe your suggestion
This repo has
markdownlint-cli2
as a dependency, which allows us to run lint checks and fixes via our npm scripts inpackage.json
, using the built-in rules in our markdownlint config files, as well as our various custom rules in themarkdownlint
directory.Some rules (not all) have fixers included, so running our
fix:lesson
orfix:project
scripts will automatically resolve some errors, such as using_
instead of*
, or not wrapping headings with blank lines etc. Some rules don't have fixers included, as they are more context-based (e.g. descriptive links) and need to be addressed on a case-by-case basis. That, or the built-in rule with all its various options make a built-in fixer a little trickier.As per the layout style guide, we use lazy numbering with
1
s, meaning any ordered list must be prefixed with1.
and we let the markdown converter figure out the correct numbering. We enforce this with the built-in MD029 rule. However, MD029 does not have a built-in fixer. And we want one. So we'll have to do it ourselves.What we want
We need to deactivate the MD029 rule in our base config file, then write a new custom rule that finds all lines that are ordered list items and are not prefixed with
1.
, and report the appropriate linting errors on them.The custom rule will also need to include fix information so that when either
fix:*
scripts are run, these ordered list items' prefixes are replaced with1.
.2.
, the nested2.
, and3.
should flag errors.Running the
fix:*
script should fix the above toThe rule itself will be written in JavaScript.
If you would like to be assigned to work on this, please comment below.
Acceptance criteria
markdownlint
directory, make a directory for the new custom rule containing the rule.js
file. Use the markdownlint custom rules guide and the other custom rules to help you.fix:*
scripts to fix the appropriate lines.tests
directory containing an.md
file showcasing instances where the rule will flag, and when the rule passes. This test file must not flag any errors other than the custom rule.markdownlint/docs
, create a documentation.md
file for the new rule so that it can be linked by the custom rule when it errors. It is okay if this documentation file includes unavoidable lint errors - it will not be run through the lint check action when you PR..markdownlint-cli2.jsonc
, deactivate theMD029
rule by changing its value tofalse
(no object, justfalse
). Its comment will need amending to say it's being overridden by the custom rule (provide the custom rule code)..js
file) to.markdownlint-cli2.jsonc
's"customRules"
array.Path
Other / NA
Lesson Url
N/A
(Optional) Discord Name
No response
(Optional) Additional Comments
No response
The text was updated successfully, but these errors were encountered: