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

Commit

Permalink
Added readme.md for NPMJS
Browse files Browse the repository at this point in the history
  • Loading branch information
Gaurav Nelson committed Jun 23, 2017
1 parent 6fc44b2 commit 97d2e0b
Showing 1 changed file with 64 additions and 0 deletions.
64 changes: 64 additions & 0 deletions readme.md
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 [markdown-link-check](https://github.com/tcort/markdown-link-check) module)

## Installation
To add the module to your project, run:

```bash
npm install --save asciidoc-link-check
```

To install the command line tool globally, run:

```bash
npm install -g asciidoc-link-check
```

## API
Use the following function:


```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

```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

```bash
asciidoc-link-check README.adoc
```

#### Check links for an online file

```bash
asciidoc-link-check https://github.com/gaurav-nelson/asciidoc-link-check/blob/master/README.adoc
```

#### Check links from standard input

```bash
cat *.adoc | asciidoc-link-check
```

0 comments on commit 97d2e0b

Please sign in to comment.