Hard Line Breaks

Since adjacent lines of text are combined into a single paragraph when Asciidoctor converts a document, that means you can wrap paragraph text or put each sentence or phrase on a separate line. The line breaks won’t appear in the output.

However, if you want the line breaks in a paragraph to be preserved, you can use a space followed by a plus sign (+) or set the hardbreaks option on the paragraph. All of the line breaks in paragarphs for an entire document can be preserved with the hardbreaks-option document attribute.

Hard line breaks are automatically retained in literal, listing, source, and verse blocks and paragraphs.

Inline line break syntax

To preserve a line break in a paragraph, type a blank space followed by a plus sign (+) at the end of the line. This results in a visible line break (e.g., <br>) following the line.

Example 1. Line breaks preserved using a space followed by the plus sign (+)
Rubies are red, +
Topazes are blue.

The result of Example 1 is displayed below.

Rubies are red,
Topazes are blue.

hardbreaks option

To retain all of the line breaks in an entire paragraph, assign the hardbreaks option to the paragraph using an attribute list.

Example 2. Line breaks preserved using the hardbreaks option
[%hardbreaks]
Ruby is red.
Java is beige.

The result of Example 2 is displayed below.

Ruby is red.
Java is beige.

hardbreaks-option attribute

To preserve line breaks in all paragraphs throughout your entire document, set the hardbreaks-option document attribute in the document header.

Example 3. Line breaks preserved throughout the document using the hardbreaks-option attribute
= Line Break Doc Title
:hardbreaks-option:

Rubies are red,
Topazes are blue.