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

get-markdown-links

v1.1.7

Published

Finds and validates links in markdown (*.md) files.

Readme

Get Markdown Links

A simple Node.js library that checks and validates URL links in a given markdown (*.md) file. It can either be used through the CLI or imported as a module to other JavaScript projects.

NPM Installation

$ npm install get-markdown-links

Note: When using the CLI, if the package was installed locally, you must use the npx mdlinks command, otherwise it will not work. If installed globally, mdlinks will suffice.

CLI Usage Instructions

$ mdlinks path\to\markdown\file.md

This will print to the console a list of all links found in the provided markdown (.*md) file.

$ mdlinks path\to\markdown\file.md --validate

This will validate all links found inside the provided markdown (.*md) file through a quick http(s) request and then print to the console a list of all the validated links.

$ mdlinks path\to\markdown\file.md --stats

This will print to the console the unique, as well as the total number of links found inside the provided markdown (.*md) file.

$ mdlinks path\to\markdown\file.md --validate --stats

This will print to the console the unique, broken and total number of links found inside the provided markdown (.*md) file.

$ mdlinks path\to\directory

This will print to the console a list of all the markdown files found in the provided directory.

JS Usage Instructions

const mdLinks = require("../index");

First, we import the module so we can then call the mdLinks function.

The mdLinks function can be called with one or two arguments, the file path and an option.

  • mdLinks(filePath).then().catch();

  • mdLinks(filePath, { option }).then().catch();

Some examples of valid file paths:

  • './path/to/md/file.md'
  • './file.md'
  • 'file.md'
  • '\file.md'
  • '\\path\\to\\md\\file.md'

Note: In order for the file path to work, backslashes must be escaped or forward slashes must be used instead.

One, two or five link collection arrays will be returned depending on the option set as the second argument:

mdLinks('./path/to/md/file.md').then((result) => {}).catch((error) => {});

When called without an option, it will return an object with a single array parsedLinksCollection with all the links found in the provided markdown (.*md) file.

mdLinks('./path/to/md/file.md', { validate: true }).then((result) => {}).catch((error) => {});

When the option is set to { validate: true }, it will validate all the links through a quick http(s) request and then return an object with two arrays, parsedLinksCollection with all the non-validated links and validatedLinksCollection with all the validated links found inside the provided markdown (*.md) file.

mdLinks('./path/to/md/file.md', { stats: true }).then((result) => {}).catch((error) => {});

When the option is set to { stats: true }, it will filter all the unique links and then return an object with two arrays, parsedLinksCollection with all the non-validated links and uniqueLinksCollection with all the unique links found inside the provided markdown (*.md) file.

mdLinks('./path/to/md/file.md', { validateStats: true }).then((result) => {}).catch((error) => {});

When the option is set to { validateStats: true }, it will first validate all the links through a quick http(s) request, then filter all the unique, working and broken links and then return an object with five arrays, parsedLinksCollection, with all the non-validated links, validatedLinksCollection with all the validated links, uniqueLinksCollection with all the unique links, workingLinksCollection with all the links that work and finally brokenLinksCollection with all the broken links found inside the provided markdown (*.md) file.

HELP

If you need more help, you can contact me at ugocinc (at) gmail (dot) com.

GitHub

GitHub Repository

In case you find any bugs you can create a New Issue on GitHub and I will look into it.