= Section Titles and Levels

Sections partition the document into a content hierarchy.
A section is an implicit enclosure.
Each section begins with a title and ends at the next sibling section, ancestor section, or end of document.
Nested section levels must be sequential.

== Section level syntax

A section title marks the beginning of a section and also acts as the heading for that section.
The section title must be prefixed with a section marker, which indicates the section level.
A section marker can range from two to six equal signs and must be followed by a space.
The number of equal signs in the marker represents the nesting level (using a 0-based index) of the section.

.Section titles available in an article doctype
[source]
----
include::example$section.adoc[tag=base]
----

The section titles are rendered as:

====
include::example$section.adoc[tag=b-base]
====

Section levels must be nested logically.
There are two rules you must follow:

. A document can only have multiple level 0 sections if the `doctype` is set to `book`.
 ** The first level 0 section is the document title; subsequent level 0 sections represent parts.
. Section levels cannot be skipped when nesting sections (e.g., you can't nest a level 5 section directly inside a level 3 section; an intermediary level 4 section is required).

For example, the following syntax is illegal:

[source]
----
include::example$section.adoc[tag=bad]
----

Content above the first section title is designated as the document's preamble.
Once the first section title is reached, content is associated with the section it is nested in.

[source]
----
include::example$section.adoc[tag=content]
----

TIP: In addition to the equals sign marker used for defining section titles, Asciidoctor recognizes the hash symbol (`#`) from Markdown.
That means the outline of a Markdown document will be converted just fine as an AsciiDoc document.

== Titles as HTML headings

When the document is converted to HTML 5 (using the built-in `html5` backend), each section title becomes a heading element where the heading level matches the number of equal signs.
For example, a level 1 section (`==`) maps to an `<h2>` element.
