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

Commit

Permalink
README in md format for npmjs and package update
Browse files Browse the repository at this point in the history
  • Loading branch information
Gaurav Nelson committed Mar 29, 2018
1 parent c8ccb09 commit 6c475b5
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 52 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -57,3 +57,5 @@ typings/
# dotenv environment variables file
.env

#package-lock
package-lock.json
92 changes: 49 additions & 43 deletions README.adoc → README.md
Original file line number Diff line number Diff line change
@@ -1,74 +1,80 @@
= asciidoc-link-check
Checks if all hyperlinks in an asciidoc file are alive(or dead).
(Based on [markdown-link-check](https://github.com/tcort/markdown-link-check) module)

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

++++
<a href="https://asciinema.org/a/TsMPXxqz92aJIeYhUQTsxbpjn?autoplay=1"><img src="https://raw.githubusercontent.com/gaurav-nelson/asciidoc-link-check/master/scr-rec.gif"/></a>
++++

== Local Installation
Local Installation
==================

To install the command line tool, run:
[source, bash]
----

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

Usage
-----

=== Usage
(Optional) Use the `-p` or `--progress` switch to view progress.

==== Check links for a local file
[source,bash]
----
### Check links for a local file

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

### Check links for an online file

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

==== Check links from standard input
[source,bash]
----
### Check links from standard input

``` bash
cat <filename>.adoc | asciidoc-link-check -p
----
```

==== Check links in all asciidoc files in a directory
### Check links in all asciidoc files in a directory

Check recursively in the current directory:
[source,bash]
----

``` bash
find . -name \*.adoc -exec asciidoc-link-check -p {} \;
----
```

Check recursively in the other directories:
[source,bash]
----

``` bash
find <directory> -name \*.adoc -exec asciidoc-link-check -p {} \;
----
```

Using in your node project
--------------------------

=== Using in your node project
To add the module to your project, run:
[source, bash]
----

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

API
===

== API
Use the following function:

[source, javascript]
----
``` 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]
----
Examples
========

JavaScript
----------

``` javascript
'use strict';

var asciidocLinkCheck = require('asciidoc-link-check');
Expand All @@ -82,4 +88,4 @@ asciidocLinkCheck('xref:https://www.google.com[Google]', function (err, results)
console.log('%s is %s', result.link, result.status);
});
});
----
```
18 changes: 9 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,14 @@
},
"homepage": "https://github.com/gaurav-nelson/asciidoc-link-check#readme",
"dependencies": {
"asciidoc-link-extractor": "^1.0.1",
"async": "^2.6.0",
"chalk": "^2.3.0",
"commander": "^2.14.1",
"link-check": "^4.3.3",
"lodash": "^4.17.5",
"progress": "^2.0.0",
"request": "^2.83.0",
"uuid": "^3.2.1"
"asciidoc-link-extractor": ">=1.0.2",
"async": ">=2.6.0",
"chalk": ">=2.3.2",
"commander": ">=2.15.1",
"link-check": ">=4.3.3",
"lodash": ">=4.17.5",
"progress": ">=2.0.0",
"request": ">=2.85.0",
"uuid": ">=3.2.1"
}
}

0 comments on commit 6c475b5

Please sign in to comment.