Giter Club home page Giter Club logo

docker-markdownlint's Introduction

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.35.0:

docker run -v $PWD:/md peterdavehello/markdownlint:0.35.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.35.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.35.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:
    -V, --version                               output the version number
    -c, --config [configFile]                   configuration file (JSON, JSONC, JS, or YAML)
    -d, --dot                                   include files/folders with a dot (for example `.github`)
    -f, --fix                                   fix basic errors (does not work with STDIN)
    -i, --ignore [file|directory|glob]          file(s) to ignore/exclude (default: [])
    -j, --json                                  write issues in json format
    -o, --output [outputFile]                   write issues to file (no console)
    -p, --ignore-path [file]                    path to file with ignore pattern(s)
    -q, --quiet                                 do not write issues to STDOUT
    -r, --rules  [file|directory|glob|package]  include custom rule files (default: [])
    -s, --stdin                                 read from STDIN (does not work with files)
    --enable [rules...]                         Enable certain rules, e.g. --enable MD013 MD041 --
    --disable [rules...]                        Disable certain rules, e.g. --disable MD013 MD041 --
    -h, --help                                  display help for command

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.35.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.

docker-markdownlint's People

Contributors

peterdavehello avatar renovate-bot avatar renovate[bot] avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

docker-markdownlint's Issues

Either lint config is broken, or maybe documentation is wrong

At https://www.npmjs.com/package/markdownlint-cli if you look at Configuration heading, it says

markdownlint-cli reuses the rules from markdownlint package.
Configuration is stored in JSON, JSONC, YAML, or INI files in the same config format.

A sample configuration file:

{
"default": true,
"MD003": { "style": "atx_closed" },
"MD007": { "indent": 4 },
"no-hard-tabs": false,
"whitespace": false
}

So I tried it out per the documentation...


$ cat .markdownlint.json
{
  "default": true,
  "line-length": false,
  "no-bare-urls": false,
  "ul-start-left": false,
  "blanks-around-lists": false,
  "no-hard-tabs": true,
  "no-trailing-spaces": { "br_spaces": 0 }
}

$ docker run -v $PWD:/md peterdavehello/markdownlint markdownlint --rules .markdownlint.json  resume.md.jinja2
/usr/local/lib/node_modules/markdownlint-cli/node_modules/markdownlint/lib/markdownlint.js:799
      throw error;
      ^

Error: Property 'names' of custom rule at index 0 is incorrect.
    at newError (/usr/local/lib/node_modules/markdownlint-cli/node_modules/markdownlint/lib/markdownlint.js:33:14)
    at forProperty (/usr/local/lib/node_modules/markdownlint-cli/node_modules/markdownlint/lib/markdownlint.js:42:18)
    at Array.forEach (<anonymous>)
    at forRule (/usr/local/lib/node_modules/markdownlint-cli/node_modules/markdownlint/lib/markdownlint.js:37:25)
    at Array.forEach (<anonymous>)
    at validateRuleList (/usr/local/lib/node_modules/markdownlint-cli/node_modules/markdownlint/lib/markdownlint.js:29:12)
    at lintInput (/usr/local/lib/node_modules/markdownlint-cli/node_modules/markdownlint/lib/markdownlint.js:703:19)
    at Function.markdownlintSync [as sync] (/usr/local/lib/node_modules/markdownlint-cli/node_modules/markdownlint/lib/markdownlint.js:797:3)
    at lintAndPrint (/usr/local/lib/node_modules/markdownlint-cli/markdownlint.js:295:35)
    at Object.<anonymous> (/usr/local/lib/node_modules/markdownlint-cli/markdownlint.js:300:3)

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

This repository currently has no open or pending branches.

Detected dependencies

dockerfile
Dockerfile
  • node 22-alpine3.19
travis
.travis.yml
  • node 18

  • Check this box to trigger a request for Renovate to run again on this repository

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.