You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

59 lines
1.7 KiB

////
Included in:
- user-manual: Literal Text and Blocks
////
Literal paragraphs and blocks display the text you write exactly as you enter it.
Literal text is treated as preformatted text.
The text is shown in a fixed-width font and endlines are preserved.
Only <<user-manual#special-characters,special characters>> and callouts are replaced when the document is converted.
Literal blocks are defined three ways:
. Indenting the first line of a paragraph by one or more spaces
. Applying the `literal` attribute to a paragraph or block
. Using the literal block delimiter (`\....` )
When a line begins with one or more spaces it is displayed as a literal paragraph.
This method is a quick and easy way to insert code snippets.
.Implicit literal text
[source]
----
include::ex-literal.adoc[tag=imp]
----
.Result: Implicit literal text
====
include::ex-literal.adoc[tag=imp]
====
When you want an entire block of text to be literal and would prefer not to indent it, set the `literal` attribute on top of the element.
.Literal style paragraph syntax
[source]
----
include::ex-literal.adoc[tag=para]
----
.Result: Literal style paragraph
====
include::ex-literal.adoc[tag=para]
====
Finally, you can surround the content you want rendered as literal by enclosing it in a set of literal block delimiters (`\....`).
This method is useful when the content consists of several elements that are separated by blank lines.
.Literal delimited block syntax
[source]
----
include::ex-literal.adoc[tag=block]
----
Notice in the output that the bold text formatting is not applied to the text nor are the three consecutive periods replaced by the ellipsis Unicode character.
.Result: Literal delimited block
====
include::ex-literal.adoc[tag=block]
====