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-links-gchm

v0.0.2

Published

Library for extraction and validation of links in markdown files

Downloads

3

Readme

Markdown Links

Index


1. Preamble

Markdown is a markup language very popular among developers. It's used in many platforms that handle plain text (GitHub, forums, blogs, ...) and it's very common to find multiple files in that format in any kind of repository (starting with the traditional README.md).

These Markdown files usually contain links that many times are broken or are no longer valid. This greatly damages the value of the information you want to share.

2. Project Summary

I developed a JavaScript library that reads files in Markdown format, from which it can be verified, through HTTP requests, if the links contained in these files are valid and report relevant information about them, for example, the total number of links and if they'r repeated or broken.

This API uses as dependencies:

For the execution of this library, called mdLinks, I developed a command line tool (CLI), which accepts as arguments the options to validate and/or obtain statistics of the links in question.

For the CLI the dependencies are used:

3. Planning

As a starting point for the development of this project, I iterated on a flowchart that was created contemplating the minimum elements necessary to cover by the API.

MdLinks Flowchart

4. Installation

npm i md-links-gchm and configure an alias for the cli execution

or

npm i -D md-links-gchm and then run with npx mdlinks [options]

Whereas to import the module with CommonJS Modules use require/module.exports.

5. User Manual

The mdLinks library is executed and receives arguments from the command line (CLI): mdLinks path options

The path argument refers to the path of the markdown file or the directory containing markdown files, this argument is required.

While options refers to the optional arguments of validation and/or statistics of the links contained in the markdown.

  • mdLinks path --validate
  • mdLinks path --stats
  • mdLinks path --validate --stats

As a support element, I included as an argument --help in the command line. If used, a summary of how to use the library is displayed (mdLinks path --help).

Here are some examples of the visualization of these different options:

mdLinks path !options

mdLinks only path

mdLinks path --validate

mdLinks path --validate

mdLinks path --stats

mdLinks path --stats

mdLinks path --validate --stats

mdLinks path --validate --stats

mdLinks --help

mdLinks --help

6. Unit Tests

In order to verify the correct functioning of the API and to procure its optimization, unit tests were developed and implemented of the different functions that make up the library.

mdLinks Unit Tests