Giter Club home page Giter Club logo

remark-frontmatter-linter's Introduction

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.

remark-frontmatter-linter's People

Contributors

injms avatar dependabot[bot] avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.