asciidoctor-lint — advisory AsciiDoc linter

Overview

For a maintainer or agent linting .adoc sources before an MR: asciidoctor-lint is the GADHS AsciiDoc linter, published at https://gitlab.com/gadhs/standard/containers/asciidoctor-lint. It catches render bugs (broken inline formatting, duplicate auto-IDs) and style warnings. In canopy it is advisory — nothing under xtask/, .githooks/ or .gitlab-ci.yml invokes it — and several of its rule families are high-false-positive, so verify findings against the rendered HTML before chasing them. The gate that does run on every changed page is asciidoctor --failure-level WARN -o /dev/null <page> (Developer Guide).

Install

Both forms are the upstream README’s:

git clone https://gitlab.com/gadhs/standard/containers/asciidoctor-lint.git
cd asciidoctor-lint && cargo install --path .     # puts `asciidoctor-lint` on $PATH
# or, without a Rust toolchain:
docker run --rm -v "$PWD:/docs" registry.gitlab.com/gadhs/standard/containers/asciidoctor-lint:latest /docs

The rule implementations live under src/rules/asciidoc/ (ASDnnn) and src/rules/inline/ (INLnnn) in that repo — read the rule when verifying a suspected false positive.

Usage

asciidoctor-lint CHANGELOG.adoc                            # lint one file; exit 0 clean, 1 warnings, 2 errors
asciidoctor-lint --type antora docs/modules/ROOT/pages/    # the Antora dialect adds the Antora rule set
asciidoctor-lint --rule ASD005,ASD009 docs/.../file.adoc   # specific rules only
asciidoctor-lint --fix --dry-run path.adoc                 # preview auto-fixes without writing
asciidoctor-lint --best-practices path.adoc                # add the BP-family rules

Rule families and false-positive risk

Rule Severity Typical cause False-positive risk

ASD005

Error

Duplicate auto-ID from a repeated section header (e.g. === Added under every version)

Inherent to the Keep-a-Changelog format; not a render bug

ASD009

Warning

Possible unclosed ** / __ inline formatting

High — fires inside ... passthroughs where formatting is already disabled

ASD014

Warning

Undefined attribute reference {name}

Moderate — {…​} placeholders in body text render literally anyway

ASD025

Info

Missing :description: (SEO)

Style, not a bug

INL010

Warning

Constrained …​ may not render

Very high — fires on identifier-like prose such as check_time_limit() where there is no real render bug

Triage heuristic

The linter flags more than raw asciidoctor rendering actually breaks on. Confirm a render impact before fixing:

asciidoctor file.adoc -o /tmp/check.html
grep -c '<mark>' /tmp/check.html                                           # >0 means a #...# collision
grep -oE '<code>[^<]*<em>[^<]*</em>[^<]*</code>' /tmp/check.html | wc -l    # >0 means underscores broke a code span
grep -oE '<code>[^<]*<strong>[^<]*</strong>[^<]*</code>' /tmp/check.html | wc -l
grep -c '<div class="literalblock">' /tmp/check.html                       # >0 means indented Markdown sub-bullets

If those counts are zero, ASD009 / INL010 warnings on the same file are almost certainly false positives — the passthrough or surrounding context already prevented the render bug the heuristic suspected. Don’t fix them mechanically.

Filing a linter bug

If the rendered HTML is demonstrably clean and the linter still flags it, that’s a false positive. Read the rule in the linter repo, then either open an issue there or suppress it at the site:

// asciidoctor-lint:disable ASD009
… the passthrough-heavy paragraph …
// asciidoctor-lint:enable ASD009

// asciidoctor-lint:disable-next-line INL010

A repo-level .asciidoctor-lint.toml (asciidoctor-lint --init writes the default; the linter finds it by directory walk-up) can disable a rule project-wide. Canopy has none today; it would land at the repo root when first needed.

  • Developer Guide — project docs are AsciiDoc (Antora), not Markdown.

  • xtask catalog — cargo xtask docs plan-lint is the blocking ADR-013 plan-status lint (separate from this advisory tool).

Edit this page · default