Literal Blocks
Literal blocks display the text you write exactly as you see it in the source. Literal text is treated as preformatted text. The text is presented in a fixed-width font and endlines are preserved. Only special characters and callouts are replaced when the document is converted.
The literal style can be applied to content using any of the following methods:
-
indenting the first line of a paragraph by one or more spaces,
-
setting the
literal
style on a block using an attribute list, or -
enclosing the content within a pair of literal block delimiters (
....
).
Indent method
When a line begins with one or more spaces it is displayed as a literal block. This method is an easy way to insert simple code snippets.
~/secure/vault/defops
The result of Example 1 is rendered below.
~/secure/vault/defops
literal style syntax
The literal style can be applied to a block, such as a paragraph, by setting the style attribute literal
on the block using an attribute list.
[literal]
error: 1954 Forbidden search
absolutely fatal: operation lost in the dodecahedron of doom
Would you like to try again? y/n
The result of Example 2 is rendered below.
error: 1954 Forbidden search absolutely fatal: operation lost in the dodecahedron of doom Would you like to try again? y/n
Delimited literal block
Finally, you can surround the content you want rendered as literal by enclosing it in a pair of literal block delimiters (....
).
This method is useful when the content contains empty lines.
....
Kismet: Where is the *defensive operations manual*?
Computer: Calculating ...
Can not locate object.
You are not authorized to know it exists.
Kismet: Did the werewolves tell you to say that?
Computer: Calculating ...
....
The result of Example 3 is rendered below.
Kismet: Where is the *defensive operations manual*? Computer: Calculating ... Can not locate object. You are not authorized to know it exists. Kismet: Did the werewolves tell you to say that? Computer: Calculating ...
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.