Sign inSign up

peterdavehello/markdownlint

By peterdavehello

Updated over 1 year ago

🐳 Dockerized markdown-cli with proper versioning, a command line lint tool for Markdown files.

Image
11

50K+

peterdavehello/markdownlint repository overview

docker-markdownlint

Build Status Docker Hub pulls

Docker Hub badge

Dockerized markdownlint-cli with various versions, easy to use and easy to integrate with CI.

Table of Contents

Usage

Command line
Use the latest version

Without speicifying a image tag, the latest tag will be used as the latest version of markdownlint-cli:

docker run -v $PWD:/md peterdavehello/markdownlint markdownlint .
  • Replace $PWD with path of markdown files, $PWD means the current working directory.
  • If you don't want to scan all the markdown files recursively, replace . with the specify the file path and name.
Use specific version

Just like above, but specify a version tag of markdownlint-cli, for example, 0.22.0:

docker run -v $PWD:/md peterdavehello/markdownlint:0.22.0 markdownlint .
Continuous Integration (CI)
Travis CI

Enable Docker service in your .travis.yml:

services:
  - docker

And use the same command in the scripts part as the command line mentions, for example:

services:
  - docker

scripts:
  - docker run -v $TRAVIS_BUILD_DIR:/md peterdavehello/markdownlint:0.22.0 markdownlint example.md

This will lint a example markdown file called example.md

GitLab CI

Add this block to your .gitlab-ci.yml:

markdownlint:
  stage: lint
  variables:
    markdownlint_cli_version: "0.22.0"
  image: peterdavehello/markdownlint:$markdownlint_cli_version
  only:
    changes:
      - "**/*.md"
      - "**/*.markdown"
  script:
    - markdownlint .

markdownlint cli usage

Just pass -h/--help to markdownlint to get its help message, for example:

  • docker run peterdavehello/markdownlint markdownlint --help

You'll get the output like below:

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

  MarkdownLint Command Line Interface

  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

For more details, check out the markdownlint-cli project page.

Build

Build command, you need to specify a valid markdownlint version argument to MARKDOWNLINT_CLI_VER:

docker build --build-arg MARKDOWNLINT_CLI_VER="0.22.0" -t docker-markdownlint .

# Replace "docker-markdownlint" with the preferred image name

You can find a valid version on markdownlint-cli npm registry page, or just poke the registry to retrieve more details.

Tag summary

Content type

Image

Digest

sha256:941672a6a

Size

56.6 MB

Last updated

over 1 year ago

docker pull peterdavehello/markdownlint