1.0.2 • Published 2 years ago

md-links-my v1.0.2

Weekly downloads
-
License
-
Repository
github
Last release
2 years ago

Markdown Links

Índice


1. Description

Command line tool (CLI) in JavaScript, which reads and analyzes files in Markdown format, to verify the links they contain and report some statistics.

md-links

2. Installation

To use the tool, the following code must be executed:

npm install md-links-my;

3. How to use

mdLinks(path, options)

Arguments
  • path: Absolute or relative path to the file or directory. If the path passed is relative, it should resolve to relative to the directory where node is invoked from - current working directory).
  • options: An object with only the following property:
    • validate: Boolean that determines if you want to validate the links found.
    • stats: Determines the structure of the response.

The executable of the tool should be executed as follows way through the terminal:

default

Example:

md-links <path-to-file> [options]

image

By default it does not validate if the URLs respond ok or fail, it only identifies the markdown file (based on the path it receives as an argument), analyzes the Markdown file and prints the links it finds, along with the path of the file where it appears and the text inside the link.

Options

--validate

If we pass the --validate option, the module makes an HTTP request to find out if the link works or not. If the link results in a redirect to a URL that responds ok, then we'll consider the link ok.

Example:

md-links <path-to-file> [options] --validate

image

The output in this case includes the word ok or fail after the URL, as well as the status of the response received to the HTTP request to that URL.

--stats

If we pass the --stats option the output will be a text with basic statistics about the links.

md-links <path-to-file> [options] --stats

image

--stats --validate

You can also combine --stats and --validate to get statistics you need from the validation results.

md-links <path-to-file> [options] --stats --validate

image

4. Developer

By Myriam Helen Salazar.