From 6c475b50cc447edcb6e9ba8a286577be8670d0b6 Mon Sep 17 00:00:00 2001 From: Gaurav Nelson Date: Thu, 29 Mar 2018 11:46:01 +1000 Subject: [PATCH] README in md format for npmjs and package update --- .gitignore | 2 + README.adoc => README.md | 92 +++++++++++++++++++++------------------- package.json | 18 ++++---- 3 files changed, 60 insertions(+), 52 deletions(-) rename README.adoc => README.md (66%) diff --git a/.gitignore b/.gitignore index 00cbbdf..2454f1b 100644 --- a/.gitignore +++ b/.gitignore @@ -57,3 +57,5 @@ typings/ # dotenv environment variables file .env +#package-lock +package-lock.json \ No newline at end of file diff --git a/README.adoc b/README.md similarity index 66% rename from README.adoc rename to README.md index 3782cd6..426b6a9 100644 --- a/README.adoc +++ b/README.md @@ -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) - -++++ -++++ -== 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 .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 -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'); @@ -82,4 +88,4 @@ asciidocLinkCheck('xref:https://www.google.com[Google]', function (err, results) console.log('%s is %s', result.link, result.status); }); }); ----- +``` diff --git a/package.json b/package.json index a43e1f6..66ec89d 100644 --- a/package.json +++ b/package.json @@ -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" } }