The Role Attribute

An element can be assigned numerous roles.

Block Assignment

In an attribute list, there are two ways to assign a role attribute to a block element.

  1. Prefixing the name with a dot (.).

  2. Specifying the name with role=<name>.

Shorthand syntax
[.summary]
* Review 1
* Review 2
Formal syntax
[role="summary"]
* Review 1
* Review 2

To specify multiple roles using the shorthand syntax, separate them by dots.

[.summary.incremental]
* Review 1
* Review 2
[role="summary,incremental"]
* Review 1
* Review 2

Inline Assignment

The role (.) shorthand can be used on inline text.

Inline text with role assignments using formal syntax
[big goal]*free the world*
Inline text with role assignments using shorthand syntax
[.big.goal]*free the world*
The attribute list preceding formatted text can be escaped using a backslash (e.g., \[role]*bold*). In this case, the text will still be formatted, but the attribute list will be unescaped and output verbatim.
Role-playing for text enclosed in backticks

To align with other formatted (i.e., quoted) text in AsciiDoc, roles can now be assigned to text enclosed in backticks.

Given:

[.rolename]`monospace text`

the following HTML is produced:

<code class="rolename">monospace text</code>

Using the shorthand notation, an id (i.e., anchor) can also be specified:

[#idname.rolename]`monospace text`

which produces:

<a id="idname"></a><code class="rolename">monospace text</code>