You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This repo has markdownlint-cli2 as a dependency, which allows us to run lint checks and fixes via our npm scripts in package.json, using the built-in rules in our markdownlint config files, as well as our various custom rules in the markdownlint directory.
Some rules (not all) have fixers included, so running our fix:lesson or fix: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 1s, meaning any ordered list must be prefixed with 1. 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 with 1..
1. ONE
2. TWO
1. child one
2. child two
3. THREE
2., the nested 2., and 3. should flag errors.
Running the fix:* script should fix the above to
1. ONE
1. TWO
1. child one
1. child two
1. THREE
The rule itself will be written in JavaScript.
If you would like to be assigned to work on this, please comment below.
Acceptance criteria
Within the 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.
It must correctly report the line number, and the "detail" (expected and actual values).
It must include "fixInfo" that will allow the fix:* scripts to fix the appropriate lines.
In the rule's directory, create a 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.
Inside 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.
In .markdownlint-cli2.jsonc, deactivate the MD029 rule by changing its value to false (no object, just false). Its comment will need amending to say it's being overridden by the custom rule (provide the custom rule code).
Append the custom rule's file path (to the .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:
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: