# md-links-gchm

> Library for extraction and validation of links in markdown files

Latest version **0.0.2** (published 2022-12-21) · ISC license · 0 weekly downloads

## Install

```sh
npm install md-links-gchm
pnpm add md-links-gchm
yarn add md-links-gchm
bun add md-links-gchm
```

Provides the command `mdLinks`.

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.2 |
| Published | 2022-12-21 |
| First published | 2022-11-04 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=16.x |
| Dependencies | 6 |
| Unpacked size | 1.1 MB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Gabriela C. Horcasitas |
| Maintainers | gabrielahorcasitas |
| Keywords | link validation, markdown, markdown file, .md file |

## Links

- npm: https://www.npmjs.com/package/md-links-gchm
- Repository: https://github.com/gabrielahorcasitas/CDMX013-md-links
- Homepage: https://github.com/gabrielahorcasitas/CDMX013-md-links#readme
- Issues: https://github.com/gabrielahorcasitas/CDMX013-md-links/issues
- npm.io page: https://npm.io/package/md-links-gchm

## Dependencies (6)

- [axios](https://npm.io/package/axios.md) ^1.1.3
- [chalk](https://npm.io/package/chalk.md) ^5.1.2
- [yargs](https://npm.io/package/yargs.md) ^17.6.0
- [colors](https://npm.io/package/colors.md) ^1.4.0
- [marked](https://npm.io/package/marked.md) ^4.1.1
- [cheerio](https://npm.io/package/cheerio.md) ^1.0.0-rc.12

## Alternatives

- [@mdxeditor/editor](https://npm.io/package/@mdxeditor/editor.md) — 962.4K weekly downloads
- [mmdb-lib](https://npm.io/package/mmdb-lib.md) — 680.9K weekly downloads
- [playcanvas](https://npm.io/package/playcanvas.md) — 36.2K weekly downloads
- [@glw907/cairn-cms](https://npm.io/package/@glw907/cairn-cms.md) — 967 weekly downloads
- [markdown-to-confluence](https://npm.io/package/markdown-to-confluence.md) — 103 weekly downloads

## Recent versions

- 0.0.2 (latest) — 2022-12-21
- 0.0.1 — 2022-12-21
- 0.1.3 — 2022-11-08
- 0.1.2 — 2022-11-08
- 0.1.1 — 2022-11-04
- 0.1.0 — 2022-11-04

## README

# Markdown Links

## Index

* [1. Preamble](#1-preamble)
* [2. Project Summary](#2-project-summary)
* [3. Planning](#3-planning)
* [4. Installation](#4-installation)
* [5. User Manual](#5-user-manual)
* [6. Unit Tests](#6-unit-tests)

***

## 1. Preamble

[Markdown](https://es.wikipedia.org/wiki/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:

* [Axios](https://www.npmjs.com/package/axios)
* [Cheerio](https://www.npmjs.com/package/cheerio)
* [Marked](https://www.npmjs.com/package/marked)

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:

* [Colors](https://www.npmjs.com/package/colors)
* [Yargs](https://www.npmjs.com/package/yargs)

## 3. Planning

As a starting point for the development of this project, I iterated on
a [flowchart](https://whimsical.com/mdlinks-flowchart-GTqMzobjxnmCcLD28m5SHQ)
that was created contemplating the minimum elements
necessary to cover by the API.

![MdLinks Flowchart](./images_readme/mdLinks_flowChart.png)

## 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](./images_readme/mdLinks.png)

### mdLinks path --validate

![mdLinks path --validate](./images_readme/mdLinks_v.png)

### mdLinks path --stats

![mdLinks path --stats](./images_readme/mdLinks_s.png)

### mdLinks path --validate --stats

![mdLinks path --validate --stats](./images_readme/mdLinks_v_s.png)

### mdLinks --help

![mdLinks --help](./images_readme/mdLinks_h.png)

## 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](./images_readme/mdLinks_tests.png)

---
_Source: https://npm.io/package/md-links-gchm · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
