Roles
You can apply the built-in roles Asciidoctor PDF provides as well as custom roles you define in your theme to paragraphs and inline phrases.
Use a built-in role
The following built-in roles can be assigned to paragraphs and inline phrases:
- lead
-
The
leadrole defines the font properties for a lead paragraph. The lead role is automatically assigned to the first paragraph of the preamble if a role is not already declared. The built-in themes configure this role to set the font size to the$base-font-size-largevalue. - big
-
The
bigrole maps the font size to the$base-font-size-largevalue. - small
-
The
smallrole maps the font size to the$base-font-size-smallvalue. - underline
-
The
underlinerole adds the underline decoration. - line-through
-
The
line-throughrole adds the strikethrough decoration. - subtitle
-
The
subtitlerole is used to configure the font properties of the subtitle of a section title.
In the example below, the built-in role big is applied to an inline phrase.
The sign spelled out [.big]#WELCOME# in glowing neon lights.
When text is enclosed in a pair of single or double hash symbols (#) and has at least one role, the role(s) will be applied to that text without adding any other implicit formatting.
That is, the text won’t be highlighted.
Use a custom role
| Before you can use a custom role in your document, you need to define it in your theme. See Custom Roles and Role Category Keys to learn how to create a custom role. |
Let’s assume you’ve defined a custom role named labeled in your theme.
role:
labeled:
font-color: #0000FF
Now, you can use this role in your documents. In the following example, the custom role is assigned to the second paragraph and an inline phrase in the last paragraph.
== Section title
A paragraph.
[.labeled]
A paragraph styled according to the custom role assigned to it.
Another paragraph.
The text [.labeled]#label me# is formatted using the styles of the custom role.
Custom roles only apply to paragraphs and inline phrases.