Hard Line Breaks
Since adjacent lines of text in AsciiDoc are combined into a single paragraph when converted, it 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 paragraphs for an entire document can be preserved with the hardbreaks-option
document attribute.
Inline line break syntax
To preserve a line break in a paragraph, insert a 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.
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.
[%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.
= Line Break Doc Title
:hardbreaks-option:
Rubies are red,
Topazes are blue.