18. Paragraph

The bulk of the content in a document is paragraph text. This is why Asciidoctor doesn’t require any special markup or attributes to specify paragraph content. You can just start typing.

In Asciidoctor, adjacent or consecutive lines of text form a paragraph element. To start a new paragraph after another element, such as a section title or table, hit the RETURN key twice to insert a blank line, and then continue typing your content.

Two paragraphs in an AsciiDoc document
This journey begins one late Monday afternoon in Antwerp.
Our team desperately needs coffee, but none of us dare open the office door.

To leave means code dismemberment and certain death.
The two paragraphs rendered using the default (html5) converter and stylesheet (asciidoctor.css)

This journey begins one late Monday afternoon in Antwerp. Our team desperately needs coffee, but none of us dare open the office door.

To leave means code dismemberment and certain death.

18.1. Alignment

Asciidoctor provides built-in roles to align the text of a paragraph. The name of the role follows the pattern text-<alignment>, where <alignment> is one of left, center, right, or justify (e.g., text-center).

Here’s an example of a paragraph with center-aligned text.

[.text-center]
This text is centered.

These built-in text alignment roles are currently supported by the HTML5 and PDF converters.

18.2. 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 either use a space followed by a plus sign (+) or set the hardbreaks option on the paragraph. This results in a visible line break (e.g., <br>) following each line.

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

Rubies are red,
Topazes are blue.

Line breaks preserved using the hardbreaks option
[%hardbreaks]
Ruby is red.
Java is black.

Ruby is red.
Java is black.

To preserve line breaks throughout your whole document, add the hardbreaks attribute to the document’s header.

Line breaks preserved throughout the document using the hardbreaks attribute
= Line Break Doc Title
:hardbreaks:

Rubies are red,
Topazes are blue.

You can also preserve line breaks using literal blocks, listing blocks, and verses.

18.3. Lead Style

Apply the lead style to any paragraph, and it will render using a larger font size. The lead style is assigned to the role attribute. You can set role using the long- or shorthand method.

Setting role using shorthand (.) and assigning it the lead value
[.lead]
This is the ultimate paragraph.
Rendered lead paragraph

This is the ultimate paragraph.

When you convert a document to HTML using the default stylesheet, the first paragraph of the preamble is automatically styled as a lead paragraph. To disable this behavior, assign any role to the first paragraph.

Disabling the automatic lead paragraph styling
[.normal]
This is a normal paragraph, regardless of its position in the document.

The presence of the custom role tells the CSS not to style it as a lead paragraph.