markdownlint-rule-title-case-style v0.4.3
markdownlint-rule-title-case-style
markdownlint custom rule for consistent Letter case style in headings.
Supported cases:
- sentence (default)
- title (using
title-case)
Scope
This rule is limited in scope to just letter casing. There are many existing
rules in the native markdownlint ecosystem that lint headings. Particular
rules of interest:
info
title-case-stylecan handle headings that have more than one sentence or end punctuation.important: This rule does not properly parse inline html By default,
no-inline-htmlhas no allowed elementsproper-namesis great for applying mistakes to proper nouns like"JavaScript".title-case-styledoes not have access to the configuration forproper-names. You can copy them totitle-case-style'signoreconfig.
Install
yarn add -D markdownlint-rule-title-case-styleThis package is a custom rule for the markdownlint ecosystem and most cases
will require installing markdownlint or related packages.
Usage
markdownlint-cli2
Currently, only .markdownlint-cli2.mjs is officially supported:
// .markdownlint-cli2.mjs
import titleCaseStyle from "markdownlint-rule-title-case-style"
export default {
customRules: [titleCaseStyle],
config: {
"title-case-style": {
// letter case style to apply
//
// "sentence" or "title" (default: sentence)
case: "sentence",
// words to ignore when applying letter case.
//
// string[] (default: [])
ignore: ["JavaScript"],
},
// ... other markdownlint configurations
},
}To automatically fix errors run markdownlint-cli2 --fix.
Ignoring errors
If there's a bug, or a case that shouldn't be enforced, simply wrap the lines as follows:
<!-- markdownlint-disable title-case-style -->
# Your Heading
<!-- markdownlint-enable title-case-style -->Issues and contributing
This tool is in an early stage. Bug reports and feature requests are encouraged. For more information see CONTRIBUTING.