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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@pchalin/markdownlint-rule-link-pattern

v0.3.0

Published

A markdownlint rule factory for validating link URLs against regex patterns

Readme

@pchalin/markdownlint-rule-link-pattern

A markdownlint rule factory for validating link URLs against regex patterns.

Each call to createLinkPatternRule() produces a markdownlint rule that can be independently configured and disabled, and that flags link URLs matching a given regex.

[!IMPORTANT]

This package is published to npm only under the @pchalin scope. The unscoped name is not ours and was once used for malware (GHSA-q3xp-j858-q9xf); never install it.

Install

npm install @pchalin/markdownlint-rule-link-pattern --save-dev

Usage

1. Create rule instances

Create a file (e.g., link-rules.mjs) that defines your rules:

import { createLinkPatternRule } from '@pchalin/markdownlint-rule-link-pattern';

export default [
  createLinkPatternRule('no-http-urls', 'Flag non-HTTPS URLs'),
  createLinkPatternRule('no-example-com', 'Flag example.com links'),
];

2. Register with markdownlint-cli2

In .markdownlint-cli2.yaml:

customRules:
  - ./link-rules.mjs

3. Configure each rule

In .markdownlint.yaml:

no-http-urls:
  pattern: 'http://(?!localhost)'
  message: Use https instead of http.

no-example-com:
  pattern: 'example\.com'
  message: Do not link to example.com.

Config shape

Each rule instance reads its configuration from the markdownlint config under its rule name:

| Property | Type | Required | Description | | ------------ | ------ | -------- | ------------------------------------------------------------------------------- | | pattern | string | yes | Regex pattern to match against link URLs. | | message | string | yes | Error message shown when a link matches. | | skip_regex | string | no | URLs matching this regex are skipped. | | replace | string | no | Replacement text; when set, enables --fix (supports $1, $2 for captures). |

Example with skip_regex

To skip URLs containing template directives (e.g., Hugo {{ }}):

no-example-com:
  pattern: 'example\.com'
  message: Do not link to example.com.
  skip_regex: '\{\{.*\}\}'

Example with replace (auto-fix)

To enable markdownlint --fix for a rule, add replace:

no-http-urls:
  pattern: 'http://'
  message: Use https instead of http.
  replace: 'https://'

no-otel-external-urls:
  pattern: 'https?://(?:www\.)?opentelemetry\.io/'
  message: Use site-relative path.
  replace: '/'

Link types checked

The rule checks all link-like tokens produced by the micromark parser:

  • Inline links: [text](url)
  • Images: ![alt](url)
  • Reference definitions: [label]: url
  • Autolinks: <https://...>
  • Bare URLs: https://... (GFM extension)

License

Apache-2.0