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 with an attribute entry in the header or body of a document. Its value is always left blank because boolean attributes only accept an empty string value, which Asciidoctor automatically assigns at processing time.
: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. |