|
This CLI application is now deprecated and no longer actively maintained. I have developed a new tool called Linkspector, which offers improved functionality and reduced false positives. I recommend using Linkspector for your needs, which is now the preferred and supported option. Linkspector offers enhanced features and better performance, and I will continue to develop and support it moving forward. I appreciate your understanding, and I hope you enjoy using Linkspector! |
(Based on markdown-link-check module)
Install with npm run:
npm install -g asciidoc-link-check(Optional) Use the -p or --progress switch to view progress.
asciidoc-link-check README.adoc --progressasciidoc-link-check https://github.com/gaurav-nelson/asciidoc-link-check/blob/master/README.adoccat <filename>.adoc | asciidoc-link-check -pCheck recursively in the current directory:
find . -name \*.adoc -exec asciidoc-link-check -p {} \;Check recursively in the other directories:
find <directory> -name \*.adoc -exec asciidoc-link-check -p {} \;- Create a JSON config file containing ignore patterns:
{ "ignorePatterns": [ { "pattern": "^https://192.17" }, { "pattern": "^https://www.google" } ] } - Use the config file option:
asciidoc-link-check README.adoc -c <configfile.json>
NOTE
To see other options that
asciidoc-link-checksupports, seemarkdown-link-checkconfig file format at https://github.com/tcort/markdown-link-check#config-file-format
To add the module to your project, run:
npm install --save asciidoc-link-check-
Clone the repository:
git clone https://github.com/gaurav-nelson/asciidoc-link-check.git -
Open the repository directory:
cd asciidoc-link-check -
Build a Docker image:
docker build --tag asciidoc-link-check . -
Add current directory with your
test.adocfile as read only volume to thedocker runcommand:docker run -v ${PWD}:/tmp:ro --rm -i asciidoc-link-check /tmp/test.adoc
Use the following function:
asciidocLinkCheck(asciidoc, [opts], callback)Accepts a string containing asciidoc formatted text and a callback function,
extracts all links and checks if they are alive or dead. Then calls the
callback function with (err, results).
-
optsoptional objectsignorePatterns: An array of objects of regular expressions patterns.
'use strict';
var asciidocLinkCheck = require('asciidoc-link-check');
asciidocLinkCheck('xref:https://www.google.com[Google]', function (err, results) {
if (err) {
console.error('Error', err);
return;
}
results.forEach(function (result) {
console.log('%s is %s', result.link, result.status);
});
});