Literal Blocks

Literal 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 special characters and callouts are replaced when the document is converted.

Literal syntax

Literal blocks are defined three ways:

  1. Indenting the first line of a paragraph by one or more spaces

  2. Applying the literal attribute to a paragraph or block

  3. Using the literal block delimiter (.... )

Implicit indent method

When a line begins with one or more spaces it is displayed as a literal block. This method is a quick and easy way to insert code snippets.

Implicit literal text
 ~/secure/vault/defops
Result: Implicit literal text
~/secure/vault/defops

Literal style

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 syntax
[literal]
error: The requested operation returned error: 1954 Forbidden search for defensive operations manual
absolutely fatal: operation initiation lost in the dodecahedron of doom
would you like to die again? y/n
Result: Literal style
error: The requested operation returned error: 1954 Forbidden search for defensive operations manual
absolutely fatal: operation initiation lost in the dodecahedron of doom
would you like to die again? y/n

Delimited literal block

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
....
Lazarus: Where is the *defensive operations manual*?

Computer: Calculating ...
Can not locate object that you are not authorized to know exists.
Would you like to ask another question?

Lazarus: 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.

Result: Literal delimited block
Lazarus: Where is the *defensive operations manual*?

Computer: Calculating ...
Can not locate object that you are not authorized to know exists.
Would you like to ask another question?

Lazarus: Did the werewolves tell you to say that?

Computer: Calculating ...