School project that develop a Command line tool used to extract links from texts in markdown format and checks whether each link is alive (200 OK) or dead.
To add the module to your project, run:
npm install CitlalliDMG/md-links
To install the command line tool globally, run:
npm install -g CitlalliDMG/md-links
If you get a permission error please try using sudo (you may need admin permissions depending on your node installation).
# using `sudo` (only if the previous step failed)
sudo npm i -g CitlalliDMG/md-links
Also if you want, you can install using a local clone.
# clone from your own fork
git clone git@github.com:<your-username>/md-links.git
cd md-links
npm install
npm link
If the above command fails, try using sudo:
sudo npm link
To remove the module globally, run:
npm uninstall -g CitlalliDMG/md-links
Given a string path containing markdown
formatted text extract all of the http links and check if they're alive or dead.
Parameters:
path
string containing the Absolute or relative path to the file or directory.options
optional options object containing any of the following optional fields:
validate
value that determines if you want to validate the links found in the file (boolean type, in CLI false by default).stats
value that determines if you want to calculate the stats of the links found in the file (boolean type, in CLI false by default).The command line tool by default expects one argument the file name (will soon accept directories) or either of the options --version or --help.
If a file name is supplied, the command line optionally takes 1 or 2 extra arguments (--validate or --stats)
If neither of the arguments is supplied, the tool displays the usage information.
Check links from a local markdown file
Check links from a local markdown file and validate
Check links from a local markdown file and stats
Check links from a local markdown folder (recursive)
Soon
Usage: mdLinks <path-to-file> [options]
Options:
--version display version number of the package
--validate makes an HTTP request to find out if the link works or not,
showing in the output the path to the md file, the URL tested,
the response of the request and the status
--stats display basic statistics of the links found in the file (total and number of unique links)
--help output usage information
Available soon
npm test
That is installable directly from the Github repository
npm install --global <github-user>/md-links
README.md
mdLinks(path, opts)
options.validate
md-links
in the path (configured inpackage.json
)--validate
--stats
--validate --stats
npm test
).