Monospace

In AsciiDoc, a span of text enclosed in a single pair of backticks (`) is displayed using a fixed-width (i.e., monospaced) font. Monospace text formatting is typically used to represent text shown in computer terminals or code editors (often referred to as a codespan).

The monospace presentation of text maps to the formatted text type known as monospaced in the AsciiDoc language.

Constrained

Here’s an example:

Example 1. Constrained monospace syntax
"`Wait!`" Indigo plucked a small vial from her desk's top drawer
and held it toward us.
The vial's label read: `E=mc^2^`; the `E` represents _energy_,
but also pure _genius!_

The result of Example 1 is rendered below.

“Wait!” Indigo plucked a small vial from her desk’s top drawer and held it toward us. The vial’s label read: E=mc2; the E represents energy, but also pure genius!

Unconstrained

As with other types of text formatting, if the text is bounded by word characters on either side, it must be enclosed in a double pair of backtick characters (``) in order for the formatting to be applied.

Here’s an example:

The command will re``link`` all packages.

Mixed Formatting

Monospaced text can also be formatted in bold or italic or both, as long as the markup pairs are entered in the right order. The monospace markup must be the outermost formatting mark, then the bold marks, then the italic marks.

Example 2. Order of inline formatting syntax
`*_monospaced bold italic_*`

The result of Example 2 is rendered below.

monospaced bold italic

Literal Monospace

To learn how to make monospace text that’s not otherwise formatted, see Literal Monospace.