Normally when we write a paragraph in Asciidoc markup the line breaks are not preserved. Multiple lines are combined into a paragraph until an empty line is found to separate paragraphs. If we want to keep line breaks we must add the plus sign (+
) at the end of the line. If we generate HTML from the Asciidoc markup a line break is inserted with a <br>
tag. We can also use the hardbreaks
document attribute to enable or disable line breaks in paragraphs without the addition of the +
symbols.
In the following Asciidoc sample we use the +
sign to keep line breaks in a paragraph:
// Use + to keep line breaks in paragraph. A sample paragraph + with line breaks + applied using the _+_ symbol. A sample paragraph without line breaks, because the _+_ symbol is not used.
We get the following result if we use the HTML backend:
We can also use the hardbreaks
attribute:
:hardbreaks: A sample paragraph with line breaks. Although the _+_ symbol is not used, but the document attribute *:hardbreaks:* is set. // Disable hardbreaks for reminder of document. :!hardbreaks:
If we generate HTML we get the following result:
Samples written with Asciidoctor 0.1.4.