remark-lint plugin to ensure that your Markdown headings capitalization is correct.
- Capitalize the first word, as well as all nouns, pronouns, verbs, adjectives, and adverbs.
- Articles, conjunctions, and prepositions should remain lowercase.
- Capitalize the first element in a hyphenated compound. The other elements are generally capitalized unless they are articles, conjunctions, or prepositions.
Some additional points to note:
- The plugin only checks the first letter of words that require capitalization.
- Words written in uppercase are automatically skipped by the plugin.
npm install remark-lint-heading-capitalizationUse like any other remark-lint plugin. Check out the remark-lint documentation for details.
Configuration (TypeScript type).
lowerCaseWords(string[], optional, example:['die', 'der', 'und']) — extends the default list of lowercase words.ignorePattern(string | string[], optional, example:'package-[a-z]+'or['package-[a-z]+', 'node-[0-9]+']) — a single regular expression pattern as a string or an array of strings, used to ignore items that match the specified pattern(s).
When this rule is turned on, the following valid.md is ok:
## Where to Ask Questions
## An Apple
## Enable 2FA on GitHub
## Flight-or-FightWhen this rule is turned on, the following invalid.md is not ok:
## Where To Ask questions
## an Apple
## Enable 2FA On GitHub
## Flight-Or-fight1:1-1:26 warning Heading capitalization error. Expected: 'Where to Ask Questions' found: 'Where To Ask questions' heading-capitalization remark-lint
2:1-2:12 warning Heading capitalization error. Expected: 'An Apple' found: 'an Apple' heading-capitalization remark-lint
3:1-3:24 warning Heading capitalization error. Expected: 'Enable 2FA on GitHub' found: 'Enable 2FA On GitHub' heading-capitalization remark-lint
4:1-4:19 warning Heading capitalization error. Expected: 'Flight-or-Fight' found: 'Flight-Or-fight' heading-capitalization remark-lint
If you find this tool helpful, consider supporting us: