Set Boolean Attributes

A boolean attribute is a built-in attribute that acts like a toggle. Its sole function is to turn on a feature or behavior.

Boolean attribute entry syntax

A boolean attribute is set using an attribute entry in the header or body of a document. The value of a boolean value is always left blank because boolean attributes in AsciiDoc only accept an empty string value. In AsciiDoc, an attribute that is set, but has an empty value, is interpreted as the true state and an attribute which is not set is interpreted as the false state. However, a processor may interpret a value of true as the true state as well.

:name-of-a-boolean-attribute: (1)
1 On a new line, type a colon (:), directly followed by the attribute’s name and then another colon (:). After the closing colon, press Enter. The attribute is now set and its behavior will be applied to the document.

Declare a boolean attribute

Let’s use an attribute entry to turn on the built-in boolean attribute named sectanchors. When sectanchors is set, it activates an anchor in front of a section title when a cursor hovers over it.

= Document Title
:sectanchors: (1)
1 The value of sectanchors is always left empty because it’s a boolean attribute.