0.8.10 • Published 22 days ago

@injms/remark-frontmatter-linter v0.8.10

Weekly downloads
-
License
SEE LICENSE IN li...
Repository
github
Last release
22 days ago

Remark Frontmatter linter

Uses eslint-plugin-yml to lint YAML frontmatter in a Markdown file.

Requirements:

🏗️ Installation

Install this package - @injms/remark-frontmatter-linter - and its dependencies - remark-lint and remark-frontmatter - with npm:

npm install remark-lint remark-frontmatter @injms/remark-frontmatter-linter

⌨️ Set up for remark-cli

Add the plugin in the list of plugins, where ever that is being set, remembering to add it after the remark-lint and remark-frontmatter plugins.

// .remarkrc.mjs
export default {
  "plugins": [
    "remark-lint",
    "remark-frontmatter",
    "remark-frontmatter-linter",
  ],
}

⚙️ Configuration

By default the rules are the standard YML set of rules (plugin:yml/standard) but with indentation changed to be 2 spaces.

To change this, both the extends and rules properties can be set in the Remark config file, for example:

// .remarkrc.mjs
export default {
  "plugins": [
    "remark-lint",
    "remark-frontmatter",
    [
      "remark-frontmatter-linter",
      {
        extends: [
          'yml:prettier',
        ],
        rules: {
          'yml/indent': ['error', 4],
          'yml/plain-scalar': 'off',
        }
      }
    ],
  ],
}

See the eslint-plugin-yml configuration docs for a list of available configs and rules.

Setting anything in extends will overwrite the default use of yml:standard.

Setting anything in rules will add to the rules - so unless yml/indent is set then the default of 2 spaces will be used.

🧪 Tests

npm run test

This plugin uses the AVA test runner.

0.8.10

22 days ago

0.8.9

27 days ago

0.8.8

1 month ago

0.8.7

1 month ago

0.8.6

1 month ago

0.8.5

1 month ago