Awesome
remark-lint-appropriate-heading
Check that the top-level heading matches the directory name
This remark-lint rule was created for standard-readme.
This rule checks that the top title is in the right position, and that it references the current directory name.
Options: exact
, slug
, default: exact
With default options, exact
, checks that the exact lowercase title matches the directory name.
With options slug
, checks that the slugified title matches the directory name.
Invalid, ~/example/a.md
:
Paragraph
# Example
Invalid, ~/example/b.md
:
Paragraph
Invalid, ~/example/c.md
:
# Not “Example”
Valid, ~/example/d.md
:
# Example
Valid, ~/some-example/e.md
, with option slug
:
# Some Example
# Some-Example
Using the rule
Via .remarkrc
npm install -g remark-cli
npm install remark-lint remark-lint-appropriate-heading
Then, set up your .remarkrc
:
{
"plugins": [
"lint",
"lint-appropriate-heading"
]
}
Now you can use the following command to run the lint:
remark readme.md
Via CLI
npm install -g remark-cli
npm install remark-lint remark-lint-appropriate-heading
remark -u lint -u lint-appropriate-heading readme.md