0.0.4 • Published 1 month ago

md-check-link v0.0.4

Weekly downloads
-
License
ISC
Repository
github
Last release
1 month ago

md-check-link

REUSE status

This tool was created as a a fork of markdown-link-check with added support for checking links to docsify aliases. During the development it turned out that the original tool is not maintained anymore, and too many changes are required to make it performant and fully functional. Therefore, it was decided to create a new tool with a new name and keep only similar configuration options and reporting format.

Features:

  • check for broken links in markdown files
  • validate anchors to headers in the same file and to other files in the same project (relative links)
  • validate links to external resources
  • validate links to websites hosting markdowns with docsify (e.g. GitHub pages)
  • parallel processing of links
  • configurable timeout and retry count
  • configurable replacement patterns for links (e.g. to replace docsify aliases with raw links)
  • configurable alive status codes

Prerequisites

Installation

npm install -g md-check-link

Usage

Usage: md-check-link [options] [filesOrFolders...]

Options:
  -V, --version            output the version number
  -n, --parallel <number>  number of parallel requests (default: 2)
  -c, --config [config]    apply a config file (JSON), holding e.g. url specific header configuration
  -q, --quiet              displays errors only
  -h, --help               display help for command

Example:

md-check-link -n 8 -c config.json docs

Sample github action

This workflow verify links in all markdown files in the repository. It runs every day at midnight and on pull requests. You can also run it manually.

name: Verify markdown links

on:
  workflow_dispatch:
  schedule:
    - cron: '0 0 * * *'
  pull_request:
  
jobs:
  verify-links:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - name: Install node.js
        uses: actions/setup-node@v4
        with:
          node-version: '20.x'
      - name: Install md-check-link
        run: npm install -g md-check-link
      - name: Verify links
        run: |
          md-check-link -q -n 8 -c https://raw.githubusercontent.com/kyma-project/md-check-link/main/.mlc.config.js ./

Configuration file

{
  "ignorePatterns": [
    {
      "pattern": "^http://example.net"
    }
  ],
  "replacementPatterns": [
    {
      "docsify": true,
      "pattern": "^https://kyma-project.io/#/btp-manager/",
      "replacement": "https://raw.githubusercontent.com/kyma-project/btp-manager/main/docs/"
    },
    {
      "pattern": "^/api-gateway/",
      "replacement": "https://raw.githubusercontent.com/kyma-project/api-gateway/main/docs/"
    }

  ],
  "timeout": "10s",
  "retryCount": 5,
  "aliveStatusCodes": [200]
}

Contributing

See the Contributing Rules.

Code of Conduct

See the Code of Conduct document.

Licensing

See the license file.

0.0.3

1 month ago

0.0.4

1 month ago

0.0.2

2 months ago

0.0.1

3 months ago

3.12.6

3 months ago

3.12.5

3 months ago

3.12.2

3 months ago