2.0.3 • Published 9 months ago

markdownlint-rule-trace-template-headers v2.0.3

Weekly downloads
-
License
MIT
Repository
github
Last release
9 months ago

markdownlint-rule-trace-template-headers

A custom markdownlint rule that provides the functionality to check the headers of a Markdown file based on the headers of a template file, verifying the match and order of the headers.

This package is compatible with markdownlint-cli2 and not markdownlint-cli.

Usage

CLI

  1. Install dependencies.

    npm install -D markdownlint-cli2 @lainNao/markdownlint-trace-template-headers
  2. Create config file.

    touch .markdownlint-cli2.jsonc
  3. Edit .markdownlint-cli2.jsonc .

    • if markdownlint-rule-trace-template-headers is v2 or higher
    {
      "customRules": [
        "markdownlint-rule-trace-template-headers"
      ],
      "config": {
        "markdownlint-rule-trace-template-headers": {
          "settings": [
            {
              "templateFile": "YOUR_TEMPLATE_FILE.md", // template headers file
              "includedFiles": ["*.md"], // files to lint
              "excludedFiles": [] // files to exclude
            },
            ...
          ]
        }
      }
    }
    • if markdownlint-rule-trace-template-headers is v1 or lower
    {
      "customRules": [
        "markdownlint-rule-trace-template-headers"
      ],
      "config": {
        "markdownlint-rule-trace-template-headers": {
          "templateFile": "YOUR_TEMPLATE_FILE.md", // template headers file
          "includedFiles": ["*.md"], // files to lint
          "excludedFiles": [] // files to exclude
        }
      }
    }
  4. Run lint.

    npx markdownlint-cli2 SOME_MARKDOWN_FILE.md

VSCode

  1. Install markdownlint in your VSCode extensions marketplace.
  2. Create and edit .markdownlint-cli2.jsonc like above.
  3. Verify the lint rule works works in Editor.

Other

To disable the rule, edit .markdownlint-cli2.jsonc .

{
  "customRules": [
    "markdownlint-rule-trace-template-headers"
  ],
  "config": {
    "markdownlint-rule-trace-template-headers": false    // change this value to falsy
  }
}

TODO

  • Improve CI/CD. Add auto tests and auto versioning, updating changelog, release scripts.
  • Create CONTRIBUTION.md
  • Config to select error/warn
2.0.3

9 months ago

1.0.2

11 months ago

2.0.2

10 months ago

1.0.1

11 months ago

1.0.6

11 months ago

1.0.4

11 months ago

2.0.0

10 months ago

1.0.3

11 months ago

1.0.0

1 year ago