elanny-md-links

1.0.1 • Public • Published

Markdown Links

md-links

Md-links is a library which will help you to validate URLs inside markdown files. You have four options between you can choose.

Índice


1. Preamble

Markdown is a language very used by developers. It can contain a lot of links, and sometimes those links can be broken. So, "Laboratoria" propost us to make a program which helps us to obatin the information needed of those links.

This is the main reason of this library.

Feel free to use it and send me feedback. It will be appreciated. un lenguaje de marcado

md-links

2. Installation

You can install it by npm:

$ npm i elanny-md-links

And now you can start to use it.

3. How to use it

Once installed you can run it in the terminal.

mdlinks-checker <path-to-file> [options]

About <path-to-file>, you can enter a relative or a absolute path.

About [options], you can choose between --help, --validate, --stats, or the last two together.

4. Structure of the Project

This project const of two part API and CLI.

1) JavaScript API

mdLinks(path, options)

FlowChart

API-flowchart

You need to enter the following, with the path you want to check:

md-links <path-to-file>

Output

For Default it is validate:false :

  • href: URL found.
  • text: Text that appears inside the link (<a>).
  • file: Path of the file where the link was found.

So the output will be:

$ md-links ./some/example.md
href: http://google.com/
text: Google
file: ./some/example.md

2) CLI (Command Line Interface)

FlowChart

CLI-flowchart

As above you enter md-links and the path. However, you can choose between --validate, --stats, --validate --stats or --stats --validate.

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

Options

--validate

If you enter --validate, it will make an HTTP request. So the output will be the following:

$ md-links ./some/example.md --validate
href: http://google.com/
text: Google
file: ./some/example.md
status: 200
message: OK

Or

$ md-links ./some/example.md --validate
href: https://otra-cosa.net/algun-doc.html
text: algún doc
file: ./some/example.md
status: 404
message: FAIL

--stats

If you enter --stats the output will be a text with statistics basics about links.

The Output will be:

$ md-links ./some/example.md --stats
Total: 3
Unique: 3

--validate --stats or --stats --validate

You can use --stats y --validate together to get statistics they need from the validation results.

$ md-links ./some/example.md --stats --validate
Total: 3
Unique: 3
Broken: 1

5. Resources used in this project

6. Author

Elanny Torres

Package Sidebar

Install

npm i elanny-md-links

Weekly Downloads

0

Version

1.0.1

License

MIT

Unpacked Size

108 kB

Total Files

21

Last publish

Collaborators

  • elanny