markdownlint-rule-title-case-style

0.4.3 • Public • Published

markdownlint-rule-title-case-style

markdownlint custom rule for consistent Letter case style in headings. Supported cases:

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:

  • no-trailing-spaces

  • no-trailing-punctuation

    info title-case-style can handle headings that have more than one sentence or end punctuation.

  • no-inline-html

    important: This rule does not properly parse inline html By default, no-inline-html has no allowed elements

  • proper-names

    proper-names is great for applying mistakes to proper nouns like "JavaScript". title-case-style does not have access to the configuration for proper-names. You can copy them to title-case-style's ignore 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.

Readme

Keywords

Package Sidebar

Install

npm i markdownlint-rule-title-case-style

Weekly Downloads

67

Version

0.4.3

License

MIT

Unpacked Size

15.3 kB

Total Files

11

Last publish

Collaborators

  • greyscaled