Text Span and Built-in Roles
Instead of applying explicit formatting to text, you can enclose a span of a text in a non-formatting element. This type of markup is referred to as a text span (formerly known as unquoted text). It’s purpose is to allow attributes such as role and ID to be applied to unformatted text. Though those attributes can still be used to apply styles to the text.
Text span syntax
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.
If no attrlist is present, the formatting pair will be interpreted as highlighted text instead. |
The text [.underline]#underline me# is underlined.
When Example 1 is converted to HTML, it translates into the following output.
The text <span class="underline">underline me</span> is underlined.
As you can see, it’s up to the stylesheet to provide styles for this element.
Typically, this means you’ll need to define custom inline styles that map to the corresponding class.
In this case, since underline
is a built-in role, the style is provided for you.
Built-in roles for text
The AsciiDoc language provides a handful of built-in roles you can use to provide formatting hints for the text. While these roles are often used with a text span, they can also be used with any other formatted text for which a role is accepted.
Not all converters recognize these roles, though you can expect them to at least be supported by the HTML converter. |
These roles are as follows:
- underline
-
Applies an underline decoration to the span of text.
- overline
-
Applies an overline decoration to the span of text.
- line-through
-
Applies a line-through (aka strikethrough) decoration to the span of text.
- nobreak
-
Disables words within the span of text from being broken.
- nowrap
-
Prevents the span of text from wrapping at all.
- pre-wrap
-
Prevents sequences of space and space-like characters from being collapsed (i.e., all spaces are preserved).
Deprecated roles
There are several built-in roles that were once supported in AsciiDoc, but have since been deprecated.
These roles include big
, small
, named colors (e.g., aqua
), and named background colors (e.g., aqua-background
).
You should create your own semantic roles in place of these deprecated roles.