asciidoc-link-check
Checks if all hyperlinks in an asciidoc file are alive(or dead).
Last updated 5 months ago by gaurav-nelson .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install asciidoc-link-check 
SYNC missed versions from official npm registry.

(Based on markdown-link-check module)

Local Installation

To install the command line tool, run:

npm install -g asciidoc-link-check

Usage

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

Check links for a local file

asciidoc-link-check README.adoc --progress

Check links for an online file

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

Check links from standard input

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

Check links in all asciidoc files in a directory

Check 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 {} \;

Ignore specific links

  1. Create a JSON config file containing ignore patterns:
    {
        "ignorePatterns": [
            { "pattern": "^https://192.17" },
            { "pattern": "^https://www.google" }
        ]
    
    }
    
  2. Use the config file option:
    asciidoc-link-check README.adoc -c <configfile.json>
    

Using in your node project

To add the module to your project, run:

npm install --save asciidoc-link-check

Docker Run

  1. Clone the repository:

     git clone https://github.com/gaurav-nelson/asciidoc-link-check.git
    
  2. Open the repository directory:

     cd asciidoc-link-check
    
  3. Build a Docker image:

     docker build --tag asciidoc-link-check .
    
  4. Pipe any asciidoc file test.adoc to docker run:

     docker run --rm -i asciidoc-link-check < test.adoc
    

API

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).

  • opts optional objects

    • ignorePatterns: An array of objects of regular expressions patterns.

Examples

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);
    });
});

Current Tags

  • 1.0.13                                ...           latest (5 months ago)

14 Versions

  • 1.0.13                                ...           5 months ago
  • 1.0.12                                ...           a year ago
  • 1.0.11                                ...           2 years ago
  • 1.0.10                                ...           2 years ago
  • 1.0.9                                ...           2 years ago
  • 1.0.8                                ...           2 years ago
  • 1.0.7                                ...           2 years ago
  • 1.0.6                                ...           3 years ago
  • 1.0.5                                ...           3 years ago
  • 1.0.4                                ...           3 years ago
  • 1.0.3                                ...           3 years ago
  • 1.0.2                                ...           3 years ago
  • 1.0.1                                ...           3 years ago
  • 1.0.0                                ...           3 years ago
Maintainers (1)
Downloads
Today 0
This Week 1
This Month 1
Last Day 0
Last Week 0
Last Month 2
Dependencies (8)
Dev Dependencies (1)
Dependents (0)
None

Copyright 2014 - 2017 © taobao.org |