Md-link is a lib to filter and validate markdown links.
npm instal --global https://github.com/coderanac/SAP004-md-links
md-link [path] [options]
Path receive file or folder for search the links. Exemple:
md-link myFolder/YOURFILE.md
md-link YOURFILE.md
--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
1 - Make a package require
const md = require('md-link');
2 - Choose the method you want to use.
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')