markdown-links-analyzer

1.0.4 • Public • Published

mdLinks - markdown-links-analyzer

Tool that reads and analizes Markdown files, to verify its links and report some statistics.

mdLinks

Content

INSTALL

npm install markdown-links-analyzer

EXAMPLES

JavaScript API

mdLinks(path, options)

Parameters
  • path: Absolute or relative path of the file or folder.
  • options: An object with the following property:
    • validate: A boolean which indicates whether or not to validate the links found.
const mdLinks = require("markdown-links-analyzer");

mdLinks("./some/example.md")
  .then(links => {
    // => [{ href, text, file }]
  })
  .catch((e) => console.log(e.message));

mdLinks("./some/example.md", { validate: true })
  .then(links => {
    // => [{ href, text, file, status, ok }]
  })
  .catch((e) => console.log(e.message));

CLI

It is executed as follows through the terminal:

byDefault

By deafult it doesn't validates the links found, it just identifies them and prints them along with the path where they were found.

Options

--validate

With the --validate option, an HTTP request is made for each link found to verify if it works or not.

validate

The output includes the status: ok or fail of each url and their status code.

--stats

With the --stats option you can get the general statistics about the links found.

stats

You can also combine --stats and --validate to get the statistics from the links validation.

validatestats

--help

md-links --help

With this option, you can get a list of all the available commands and a guide on how to use them.

LOCAL SET UP

npm install
npm link
md-links ./some-file

FLOWCHART

Diagram

BOILERPLATE

.
├── README.md
├── package.json
├── package-lock.json
├── .gitignore
├── src
|  ├── mdLinks.js
|  ├── cli.js
|  └── mdFile.js
|  └── validate.js
└── test
   └── test.js

Package Sidebar

Install

npm i markdown-links-analyzer

Weekly Downloads

0

Version

1.0.4

License

ISC

Unpacked Size

18.2 kB

Total Files

13

Last publish

Collaborators

  • fiorellachilcon