Git Product home page Git Product logo

markdown-lint's Introduction

icon

Linter for markdown | with presets

Release Build Build Docker Pulls Issues License

This repository contains source files of docker image (and github action) for markdown files linting. Additionally we provides setting (rules) for the most useful cases, like changelog file linting.

All docker images always can be found on this page.

Usage

This image contains markdownlint-cli (node-js) and:

  • Additional rules for changelog file linting (/lint/rules/changelog.js)
  • Configuration file for changelog file linting (it uses additional linting rules, /lint/config/changelog.yml)

Major image tag can be updated in any time, but all changes will be backwards compatible.

markdownlint-cli supports next options (more details can be found on project page):

Usage: markdownlint [options] <files|directories|globs>

Options:
  -h, --help                                  output usage information
  -V, --version                               output the version number
  -f, --fix                                   fix basic errors (does not work with STDIN)
  -s, --stdin                                 read from STDIN (does not work with files)
  -o, --output [outputFile]                   write issues to file (no console)
  -c, --config [configFile]                   configuration file (JSON, JSONC, or YAML)
  -i, --ignore [file|directory|glob]          files to ignore/exclude
  -r, --rules  [file|directory|glob|package]  custom rule files

Environment variables

Some linter execution options can be passed through environment variables (multiple variables usage are allowed):

Environment variable Interpretation
INPUT_RULES=/foo.js markdownlint --rules /foo.js ...
INPUT_CONFIG=/bar.yml markdownlint --config /bar.yml ...
INPUT_FIX=true markdownlint --fix ...
INPUT_OUTPUT=/foo markdownlint --output /foo ...
INPUT_IGNORE=/bar markdownlint --ignore /bar ...

Docker

For example, you can lint your CHANGELOG.md file using following command:

$ docker run --rm \
    -v "$(pwd)/CHANGELOG.md:/CHANGELOG.md:ro" \
    avtodev/markdown-lint:v1 \
    --rules /lint/rules/changelog.js \
    --config /lint/config/changelog.yml \
    /CHANGELOG.md

or

$ docker run --rm \
    -v "$(pwd)/CHANGELOG.md:/CHANGELOG.md:ro" \
    -e INPUT_RULES=/lint/rules/changelog.js \
    -e INPUT_CONFIG=/lint/config/changelog.yml \
    avtodev/markdown-lint:v1 \
    /CHANGELOG.md

GitHub Actions

jobs:
  lint-changelog:
    name: Lint changelog file
    runs-on: ubuntu-latest
    steps:
    - name: Check out code
      uses: actions/checkout@v2

    - name: Lint changelog file
      uses: docker://avtodev/markdown-lint:v1 # fastest way
      with:
        rules: '/lint/rules/changelog.js'
        config: '/lint/config/changelog.yml'
        args: './CHANGELOG.md'
        ignore: './one_file.md ./another_file.md' # multiple files must be separated with single space

    # Or using current repository as action:

    - name: Lint changelog file
      uses: avto-dev/markdown-lint@v1
      with:
        rules: '/lint/rules/changelog.js'
        config: '/lint/config/changelog.yml'
        args: './CHANGELOG.md'

License

MIT. Use anywhere for your pleasure.

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.