Skip to content

coderanac/SAP004-md-links

 
 

Repository files navigation

Markdown Links

Md-link is a lib to filter and validate markdown links.

Instalation

npm instal --global https://github.com/coderanac/SAP004-md-links

Runner command

md-link [path] [options]

Usage in CLI

Path receive file or folder for search the links. Exemple:

md-link myFolder/YOURFILE.md
md-link YOURFILE.md

Options

--validate - this command validates the links.

md-link YOURFILE.md --validate

--stats - this command brings statistics about the links: how many are there and how many are unique.

md-link YOURFILE.md --stats

--validate --stats - this command brings statistics about validated links: how many are there and how many are unique, how many are broken or ok.

md-link YOURFILE.md --validate --stats

Usage as API

Step by step

1 - Make a package require

const md = require('md-link');

2 - Choose the method you want to use.

Reference API

We offer two: one that lists the links and the other that lists and validates.

getLinks is a function that takes a path and returns an array of objects. This object has a link, title and file path.

Path {STRING} path receives a string that must have the path to a folder or file.

You don't need the absolute path, the API solves the path.

This command returns a list of the links found.

md.getLinks('YOURFILE.md');

getLinksWithValidation is a function that takes a path. It returns a promise that must also be resolved.

Path {STRING} path receives a string that must have the path to a folder or file.

You don't need the absolute path, the API solves the path.

This command returns a promise with the list of validated links. To handle the return, just do a then and log the response.

md.getLinksWithValidation('YOURFILE.md')

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%