npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

md-check-link

v0.0.4

Published

Tool for checking links in the markdown files

Downloads

902

Readme

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