@injms/remark-frontmatter-linter v0.8.10
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 testThis plugin uses the AVA test runner.