markdownlint-rule-title-case-style
v0.4.3
Published
A custom markdownlint rule for enforcing a case style in titles
Downloads
873
Readme
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-style
can handle headings that have more than one sentence or end punctuation.important: This rule does not properly parse inline html By default,
no-inline-html
has no allowed elementsproper-names
is great for applying mistakes to proper nouns like"JavaScript"
.title-case-style
does not have access to the configuration forproper-names
. You can copy them totitle-case-style
'signore
config.
Install
yarn add -D markdownlint-rule-title-case-style
This 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.