Skip to content

AsciiDoc sub-headings (==, ===) not detected as headings when :sectnums: or :toc: is set #1101

@ciechanowiec

Description

@ciechanowiec

Check for existing issues

  • Completed

Environment

Vale version: 3.10.0

OS: macOS 15.3 (Darwin arm64)

Describe the bug / provide steps to reproduce it

Description

When an AsciiDoc document sets :sectnums: or :toc: in its header, Vale stops recognising level-2+ headings (==, ===, …) as heading tokens. Only the document title (=) is detected. Any rule using scope: heading silently skips all sub-headings.


Minimal reproduction

.vale.ini:

StylesPath = styles
[*.adoc]
BasedOnStyles = Vale

styles/Test/Headings.yml:

extends: capitalization
message: "'%s' should use title-style capitalization."
level: error
scope: heading
match: $title

test.adoc - with :sectnums::

= document title
:sectnums:

== about the document

Some text.

Expected: two errors - document title and about the document

Actual: one error - only document title


Bisection

Each attribute independently triggers the bug:

Attribute Findings
(none) 2 (both headings)
:sectnums: 1 (title only)
:toc: left 1 (title only)
:sectnumlevels: 5 2 (both)
:sectanchors: 2 (both)
:toclevels: 5 2 (both)

So :sectnums: and :toc: each individually disable sub-heading detection; other common attributes do not.


Workaround

Strip :sectnums: and :toc: from the file before passing it to Vale (blanking lines rather than deleting them preserves line numbers):

sed 's/^:sectnums:.*$//; s/^:toc:.*$//' file.adoc | vale --ext=.adoc -

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions