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

hl-md

v1.0.5

Published

A lib that reads a markdown file and looks for hyperlinks in it, returning a list of them and their respective HTTP status

Downloads

9

Readme

Logo

Markdown Link Validator

A lib that reads a markdown file and looks for hyperlinks in it, returning a list of them and their respective HTTP status.

NPM Version Build StatusDownloads Stats

Lib that allows to read and analyze files in markdown format, and then check whether or not there are links. Return a list containing each link found and validate the HTTP status of them.

Install

Before installing, download and install Node.js. Node.js 6.0.0 or higher is required.

If this is a brand new project, make sure to create a package.json first with the command:

npm init

Installation is done using the npm install command:

npm install -g hl-md

Demo

For instance, if you have in your markdown file something like this:

## Title example

<p>
Lorem ipsum dolor sit amet consectetur, adipisicing elit. Quam, velit reiciendis? Repellendus corrupti perspiciatis libero, fuga officia mollitia cupiditate in quia ipsa accusantium dicta quo perferendis doloremque, voluptatum enim ipsum?
</p>

[Link to Status 200 Test](https://httpstat.us/200)

[Link to Status 404 Test](https://httpstat.us/404)

And run:

hl-md ./"filePath"/"file.md"

It will return in you terminal:

Job done!
Links list: [
  { 'Link to Status 200 Test': 'https://httpstat.us/200' },
  { 'Link to Status 404 Test': 'https://httpstat.us/404' }
]

If you add "validate" at the end, like this:

hl-md ./"filePath"/"file.md" validate

It will return in you terminal the links followed by its HTTP status:

Job done!
 Valaidated links [
{ 'Link to Status 200 Test': 'https://httpstat.us/200', status: 200 },
{ 'Link to Status 404 Test': 'https://httpstat.us/404', status: 404 }
]

Configuration for Development

  1. Clone the repo

    git clone https://github.com/acn3to/hl-md.git
  2. Install NPM packages

    npm install
  3. Use:

    npm run cli ./files/text1.md

    To get links list:

    Job done!
    Links list: [
    { 'Link to Status 200 Test': 'https://httpstat.us/200' },
    { 'Link to Status 404 Test': 'https://httpstat.us/404' },
    { 'Link to Status 300 Test': 'https://httpstat.us/300' },
    { 'Link to Status 500 Test': 'https://httpstat.us/500' },
    { 'Link to Status 201 Test': 'https://httpstat.us/201' }
    ]

    Or:

    npm run cli ./files/text1.md validate

    To get links already validated:

    Job done!
    Valaidated links [
    { 'Link to Status 200 Test': 'https://httpstat.us/200', status: 200 },
    { 'Link to Status 404 Test': 'https://httpstat.us/404', status: 404 },
    { 'Link to Status 300 Test': 'https://httpstat.us/300', status: 300 },
    { 'Link to Status 500 Test': 'https://httpstat.us/500', status: 500 },
    { 'Link to Status 201 Test': 'https://httpstat.us/201', status: 201 }
    ]
  4. Run unit tests:

    npm test

Dependencies and Structure

  • Node-fetch (to make the requests)

  • Chalk (to color the terminal output)

    Dev:

    • Jest (to unit tests)
├── files
│   └──text1.md
├── tests
│   ├── files
│   │   ├── text1.md
│   │   └── text2.md
│   └── index.test.js
├── babel.config.json
├── cli.js
├── http-validation.js
├── index.js
├── package.json
├── package-lock.json
├── README.md

Meta

Arnaldo Neto

Distributed under the 'ISC' license. See LICENSE for more information.

Contributing

  1. fork the project (https://github.com/acn3to/hl-md)
  2. Create a branch for your changes (git checkout -b feature/fooBar)
  3. Do the commit (git commit -m 'Add some fooBar')
  4. Push (git push origin feature/fooBar)
  5. Create a new Pull Request