AsciiDoc input format
AsciiDoc is a lightweight markup language popular in technical documentation. Doc Detective reads inline tests from AsciiDoc comments and detects steps from AsciiDoc syntax.
File extensions
Doc Detective processes AsciiDoc files with the following extensions:
.adoc.asciidoc.asc
Inline test syntax
AsciiDoc files use line comments for inline tests:
The comment syntax uses parentheses to distinguish test comments from regular AsciiDoc comments.
Test start:
Step:
Test end:
Ignore blocks:
Example
Here’s a complete example of an AsciiDoc file with inline tests:
Detected tests
With step detection on, AsciiDoc files detect the steps listed in What gets detected, from AsciiDoc syntax:
Comments, links, and formatting inside listings, literal blocks, and passthrough blocks aren’t read, and neither are indented literal paragraphs. A // comment counts only at the start of a line. To change what’s detected, see Selectors and custom inputs.
JSON and YAML syntax
AsciiDoc inline tests support both JSON and YAML syntax:
JSON syntax:
YAML syntax:
Both formats work identically. Choose the format that’s most readable for your team.
Best practices
- Use parentheses in comments to distinguish test statements from regular comments
- Keep test comments on a single line
- Use descriptive test IDs to identify tests in results
- Combine inline tests with detected tests so links, bold text, and listings become steps without extra comments
- Use YAML syntax for simpler, more readable inline tests
Integration with AsciiDoc toolchains
AsciiDoc test comments are standard AsciiDoc comments and don’t affect document rendering. This makes Doc Detective tests invisible to your documentation build process while still being testable.
Common AsciiDoc toolchains that work with Doc Detective:
- Asciidoctor: The most popular AsciiDoc processor
- Antora: Site generator for AsciiDoc documentation
- Jekyll AsciiDoc: AsciiDoc plugin for Jekyll
- Hugo: Static site generator with AsciiDoc support
Next steps
- Learn about inline tests for manual test definition
- See custom inputs to add detected test patterns for AsciiDoc
- Explore Markdown and DITA formats for detected test examples