# asciidoc-link-check

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

Latest version **1.0.18** (published 2024-04-08) · MIT license · 0 weekly downloads

## Install

```sh
npm install asciidoc-link-check
pnpm add asciidoc-link-check
yarn add asciidoc-link-check
bun add asciidoc-link-check
```

Provides the command `asciidoc-link-check`.

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.18 |
| Published | 2024-04-08 |
| First published | 2017-06-23 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 8 |
| Unpacked size | 18.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 8 |
| Author | Gaurav Nelson |
| Maintainers | gaurav-nelson |
| Keywords | asciidoc, adoc, link, hyperlink, href, check, checker |

## Links

- npm: https://www.npmjs.com/package/asciidoc-link-check
- Repository: https://github.com/gaurav-nelson/asciidoc-link-check
- Homepage: https://github.com/gaurav-nelson/asciidoc-link-check#readme
- Issues: https://github.com/gaurav-nelson/asciidoc-link-check/issues
- npm.io page: https://npm.io/package/asciidoc-link-check

## Dependencies (8)

- [async](https://npm.io/package/async.md) >=3.2.5
- [axios](https://npm.io/package/axios.md) >=1.6.8
- [chalk](https://npm.io/package/chalk.md) ^4.1.2
- [lodash](https://npm.io/package/lodash.md) >=4.17.21
- [progress](https://npm.io/package/progress.md) ^2.0.3
- [commander](https://npm.io/package/commander.md) >=12.0.0
- [link-check](https://npm.io/package/link-check.md) >=5.3.0
- [asciidoc-link-extractor](https://npm.io/package/asciidoc-link-extractor.md) >=1.0.3

## Alternatives

- [@sindresorhus/slugify](https://npm.io/package/@sindresorhus/slugify.md) — 3.7M weekly downloads
- [solid-js](https://npm.io/package/solid-js.md) — 2.7M weekly downloads
- [expo-glass-effect](https://npm.io/package/expo-glass-effect.md) — 2.5M weekly downloads
- [nanoassert](https://npm.io/package/nanoassert.md) — 780.8K weekly downloads
- [@ffmpeg/ffmpeg](https://npm.io/package/@ffmpeg/ffmpeg.md) — 529.5K weekly downloads

## Recent versions

- 1.0.18 (latest) — 2024-04-08
- 1.0.17 — 2023-08-29
- 1.0.16 — 2023-08-10
- 1.0.15 — 2021-02-11
- 1.0.14 — 2020-08-13
- 1.0.13 — 2020-01-10
- 1.0.12 — 2019-07-11
- 1.0.11 — 2018-11-08
- 1.0.10 — 2018-03-29
- 1.0.9 — 2018-02-09
- 1.0.8 — 2018-02-08
- 1.0.7 — 2018-01-31
- 1.0.6 — 2017-09-11
- 1.0.5 — 2017-09-08
- 1.0.4 — 2017-09-04
- … 4 more at https://npm.io/package/asciidoc-link-check/versions

## README

<table>
  <tr>
    <td>
      <h3> 🚨 Maintenance notice (November 2023) </h3>
        <p>This action is now in maintenance only mode.
        <p>I am working on a new tool similar to this action but one that reduces false positives and includes the most requested features.</p>
        <p>I am currently working on developing and testing <a href="https://github.com/UmbrellaDocs/linkspector">Linkspector</a>, and I hope to release it soon. In the meantime, I'll support this utility in maintenance-only mode as I want to focus more on <a href="https://github.com/UmbrellaDocs/linkspector">Linkspector</a>. I appreciate your understanding and patience.</p>
        <p>If you're interested in <a href="https://github.com/UmbrellaDocs/linkspector">Linkspector</a>, follow its progress on its GitHub repository. Thank you for using this action, and I hope you will enjoy <a href="https://github.com/UmbrellaDocs/linkspector">Linkspector</a> when it is ready.</p>
    </td>
  </tr>
</table>

# asciidoc-link-check
(Based on [markdown-link-check](https://github.com/tcort/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
==================

Install with `npm` run:

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

Usage
-----

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

### Check links for a local file

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

### 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 <filename>.adoc | asciidoc-link-check -p
```

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

Check recursively in the current directory:

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

Check recursively in the other directories:

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

### Ignore specific links

1. Create a JSON config file containing ignore patterns:
    ```json
    {
        "ignorePatterns": [
            { "pattern": "^https://192.17" },
            { "pattern": "^https://www.google" }
        ]

    }
    ```
1. 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:

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

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

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

---
_Source: https://npm.io/package/asciidoc-link-check · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
