D0011 admonition-syntax¶
Rule: Admonitions use a type Zensical styles and a body indented four spaces.
| Code | D0011 (stable, never reused) |
| Id | admonition-syntax |
| Category | book |
| Source | spirit_level |
| Fix | by hand |
Level per tier¶
| Tier | Level | Reason |
|---|---|---|
| small | deny |
an unknown type loses its colour and a body indented less than four spaces renders outside the box |
| small-workspace | deny |
an unknown type loses its colour and a body indented less than four spaces renders outside the box |
| medium | deny |
an unknown type loses its colour and a body indented less than four spaces renders outside the box |
| big | deny |
an unknown type loses its colour and a body indented less than four spaces renders outside the box |
| ai | off | |
| embedded | off | |
| ui | off | |
| egui | off | |
| units-strict | off | |
| units-paranoid | off |
Parameters¶
| Name | Type | Default | Meaning |
|---|---|---|---|
types |
list of strings | ["note", "abstract", "info", "tip", "success", "question", "warning", "failure", "danger", "bug", "example", "quote"] |
the admonition types the book styles |
Why¶
An admonition is a box for a note, a tip or a warning:
!!! warning "Disconnect the battery"
The board draws current from the battery even when it is switched off.
Zensical styles twelve types: note, abstract, info, tip, success, question, warning, failure, danger, bug, example and quote. Any other type renders as a plain note, so a !!! caution loses the colour that marks it as a warning. The body must be indented four spaces. With two spaces, Python-Markdown ends the box at the title and renders the body as ordinary text below it.
How to fix¶
Use one of the types in types. Indent every line of the body by four spaces. A book that adds its own types with custom CSS lists them in types.
Configure¶
[lints.admonition-syntax]
level = "deny"
types = ["note", "abstract", "info", "tip", "success", "question", "warning", "failure", "danger", "bug", "example", "quote"]
reason = "why this project wants it at this level"
Allow one finding in the code with // spirit-level: allow(admonition-syntax) <reason> (waivers); the code works there too, as in [lints.D0011].