ypp-mdlinks
v3.1.9
Published
MarkDown's Library
Downloads
2
Readme
CLI (Command Line Interface) 📦
- Install the CLI locally or globally:
$ npm install p-mdlinks
$ npm install -g p-mdlinks
- Now, get markdowns links with this command:
$ npx p-mdlinks <path-to-file> [options]
For example:
$ npx p-mdlinks ./some/example.md
./some/example.md http://ubu.com/2/3/ Link to something
./some/example.md https://deco.net/algun-doc.html some file
./some/example.md http://google.com/ Google
OPTIONS 🔨
-v | --validate
- Pass validate option to check & validate all markdown's link(s):
$ npx p-mdlinks ./some/example.md -v
$ npx p-mdlinks ./some/example.md --validate
./some/example.md http://ubu.com/2/3/ ok 200 Link to something
./some/example.md https://deco.net/algun-doc.html fail 404 some file
./some/example.md http://google.com/ ok 301 Google
-s | --stats
- Pass stats option to get the total & unique(s) of markdown's link(s):
$ npx p-mdlinks ./some/ -s
$ npx p-mdlinks ./some/example.md --stats
Total: 3
Unique: 3
-v -s | --validate --stats
- You can pass both options for totals & link's status:
$ npx p-mdlinks some -v -s
$ npx p-mdlinks some/example.md --validate --stats
Total: 3
Unique: 3
Broken: 1
JavaScript API 💻
🔗 Documentation
- Import or require 'p-mdlinks' to handle markdown link(s) as objects, validate & stats them also
// ES6
import mdLinks from 'p-mdlinks';
// CommonJS
const mdLinks = require('p-mdlinks');
mdLinks('src')
.then((res) => console.log('dir without validate: ', res))
.catch(console.log);
mdLinks('./src', { validate: true })
.then((res) => console.log('dir with validate: ', res))
.catch(console.log);
mdLinks('README.md')
.then((res) => console.log('file without validate: ', res))
.catch(console.log);
mdLinks('./README.md', { validate: true })
.then((res) => console.log('file with validate: ', res))
.catch(console.log);
mdLinks('assets')
.then((res) => console.log('dir not exist: ', res))
.catch(console.log);
mdLinks('index.js')
.then((res) => console.log('md not correct: ', res))
.catch(console.log);
mdLinks('reading.md')
.then((res) => console.log('md file not exist: ', res))
.catch(console.log);
🔗 Dependencies
Technologies used to create this project.
- [x] Git
- [x] Npm
- [x] Node.js
- [x] Javascript