Example Blocks

On this page, you’ll learn:

  • How to mark up an example with AsciiDoc.

Example syntax

An example paragraph or delimited block is useful for visually delineating content that illustrates a concept or showing the result of an operation. An example can contain any type of content and AsciiDoc syntax. Normal substitutions are applied to example content.

Example paragraph

If the example content is contiguous, i.e., not interrupted by blank lines, the block name example can be placed directly on top of the text in an attribute list ([]).

Example 1. Example paragraph syntax
.Optional title
[example]
This is an example paragraph.

Here’s the result of Example 1.

Optional title
This is an example paragraph.

Delimited example block

If the example content contains elements separated by blank lines, place the content between delimiter lines consisting of four equals signs (====). You don’t need to set the block name when you use a delimited block.

Example 2. Delimited example block syntax
.Onomatopoeia
====
The book hit the floor with a *thud*.

He could hear doves *cooing* in the pine trees`' branches.
====

Here’s the result of Example 2.

Onomatopoeia

The book hit the floor with a thud.

He could hear doves cooing in the pine trees’ branches.

Complex admonitions use the delimited example block syntax.