Skip to content
This repository has been archived by the owner on May 12, 2024. It is now read-only.

Commit

Permalink
Updated README
Browse files Browse the repository at this point in the history
  • Loading branch information
Gaurav Nelson committed Jun 23, 2017
1 parent 36e8c38 commit 2a90900
Show file tree
Hide file tree
Showing 2 changed files with 428 additions and 0 deletions.
64 changes: 64 additions & 0 deletions README.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
= asciidoc-link-check
Checks if all hyperlinks in an asciidoc file are alive(or dead).

(Uses most of the source code from xref:https://github.com/tcort/markdown-link-check[markdown-link-check] module)

== Installation
To add the module to your project, run:
[source, bash]
----
npm install --save asciidoc-link-check
----

To install the command line tool globally, run:
[source, bash]
----
npm install -g asciidoc-link-check
----

== API
Use the following function:

[source, javascript]
----
asciidocLinkCheck(asciidoc, callback)
----
Accepts a string containing `asciidoc` formatted text and a `callback`, extracts all links and checks if they are alive or dead. Then calls the `callback` with `(err, results)`.

== Examples
=== JavaScript
[source,javascript]
----
'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);
});
});
----

=== Command Line
==== Check links for a local file
[source,bash]
----
asciidoc-link-check README.adoc
----

==== Check links for an online file
[source,bash]
----
asciidoc-link-check https://github.com/gaurav-nelson/asciidoc-link-check/blob/master/README.adoc
----

==== Check links from standard input
[source,bash]
----
cat *.adoc | asciidoc-link-check
----
Loading

0 comments on commit 2a90900

Please sign in to comment.