2.0.1 • Published 4 years ago

yp-mdlinks v2.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
4 years ago

Node version Coverage Status npm dependents


Npm

CLI (Command Line Interface) 📦

Watch the video

  • You can install CLI locally or globally:
$ npm install yp-mdlinks

$ npm install -g yp-mdlinks
  • Now, you can try with this command:
$ npx yp-mdlinks <path-to-file> [options]

For example:

$ npx yp-mdlinks ./some/example.md

./some/example.md http://algo.com/2/3/ Link a algo
./some/example.md https://otra-cosa.net/algun-doc.html algún doc
./some/example.md http://google.com/ Google

OPTIONS 🔨

-v | --validate
  • You can pass validate option for check and validate all links in your file or files markdown:
$ npx yp-mdlinks ./some/example.md -v
$ npx yp-mdlinks ./some/example.md --validate

./some/example.md http://algo.com/2/3/ ok 200 Link to something
./some/example.md https://otra-cosa.net/algun-doc.html fail 404 some file
./some/example.md http://google.com/ ok 301 Google
-s | --stats
  • You can pass stats option for get information about all links in your file or files markdown:
$ npx yp-mdlinks ./some/ -s
$ npx yp-mdlinks ./some/example.md --stats

Total: 3
Unique: 3
-v -s | --validate --stats
  • You can pass both options and get more information about all links in your file or files markdown:
$ npx yp-mdlinks some -v -s
$ npx yp-mdlinks some/example.md --validate --stats

Total: 3
Unique: 3
Broken: 1

Documentation 💻

// ES6
import mdLinks from 'yp-mdlinks';
// CommonJS
const mdLinks = require('yp-mdlinks');

mdLinks('src')
  .then((res) => console.log('dir without validate: ', res))
  .catch(console.log);
mdLinks('./src/', { validate: true, stats: true })
  .then((res) => console.log('dir with validate & stats: ', 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('README.md', { stats: true })
  .then((res) => console.log('file with stats: ', 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 that were used to create this project.