npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

asciidoc-link-check

v1.0.18

Published

Checks if all hyperlinks in an asciidoc file are alive(or dead).

Downloads

255

Readme

asciidoc-link-check

(Based on markdown-link-check module)

Local Installation

Install with npm 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>

NOTE

To see other options that asciidoc-link-check supports, see markdown-link-check config file format at https://github.com/tcort/markdown-link-check#config-file-format

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. Add current directory with your test.adoc file as read only volume to the docker run command:

     docker run -v ${PWD}:/tmp:ro --rm -i asciidoc-link-check /tmp/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);
    });
});