Giter VIP home page Giter VIP logo

md-link-linter's Introduction

Markdown Link Linter

Simple command line tool that aims to detect invalid links in markdown files.

Currently following types of links are being validated:

  • relative links
  • anchor links
  • mention links
bin/mdlinklint path --exclude=vendor --exclude=node_modules

Use with Docker:

docker run -t --rm -v $PWD:/app norberttech/md-link-linter --exclude=vendor --exclude=node_modules .

First argument path can be skipped or overwritten by environment variable MD_LINTER_SCAN_DIR

MD_LINTER_SCAN_DIR=path bin/mdlinklint --exclude=vendor --exclude=node_modules

When both, argument path and environment variable are present, environment variable takes priority.

./mdlinklint --help

Usage:
  run [options] [--] [<path>]

Arguments:
  path                     Path in which md link linter should validate all markdown files

Options:
      --dry-run               Scan path and output md files
      --exclude=EXCLUDE       Exclude folders with this name (multiple values allowed)
      --mention=MENTION       Mentions whitelist (can include all team members or groups), if empty mentions are not validated (multiple values allowed)
  -h, --help                  Display help for the given command. When no command is given display help for the run command
  -q, --quiet                 Do not output any message
  -V, --version               Display this application version
      --ansi                  Force ANSI output
      --no-ansi               Disable ANSI output
  -n, --no-interaction        Do not ask any interactive question
  -bf, --break-on-failure     Break the inspection on first failure
  -rp, --root-path=ROOT-PATH  Root path used to assert absolute links. Link: [link](/nested/file.php) will check if file /nested/file.php exists from this path
  -v|vv|vvv, --verbose        Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug

Preview

Validating mentions

Using --mention option you can set allowed mentions

bin/mdlinklint path --mentions=norberttech --mention=team_name

If not used, mention link assertion will always pass.

Installation

Docker

Recommended - md-link-linter is not a type of tool you want to put into your project as a dependency because it comes with it own dependencies that might overlaps with yours.

Docker Hub - norberttech/md-link-linter

Composer

composer global require norberttech/md-link-linter

Phive

Since md-link-linter relay on \realpath function which does not work in Phar environment (explanation below) there are no plans for now to make it available through phive.

The function realpath() will not work for a file which is inside a Phar as such path would be a virtual path, not a real one.

php.net realpath documentation

Development

Install dependencies

composer install

Run tests

composer tests

Codding standards

This command might change your code!

composer cs:php:fix

md-link-linter's People

Contributors

dependabot[bot] avatar github-actions[bot] avatar aeon-automation avatar norberttech avatar stloyd avatar peter279k avatar

Stargazers

Bas van Beek avatar Dustin Smith avatar Steffen Gransow avatar Jacek Chmielewski avatar da✝ avatar  avatar Davor Minchorov avatar  avatar Nic Wortel avatar  avatar Andrzej Kostrzewa avatar

Watchers

James Cloos avatar  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.