Home/Confluence storage format reference
Confluence storage format
Alignment and indentation in Confluence storage format
Alignment is a text-align style on a paragraph or heading. Indentation is a margin-left style in steps of 30 pixels. Both map to ADF marks and round-trip. The legacy align and center macros stay as macros.
Storage format
<p style="text-align: center;">centered text</p>
<p style="text-align: right;">right aligned text</p>
<p style="margin-left: 30.0px;">indented</p>
In the editor
| How | Note |
|---|---|
| Use the native align options in the toolbar | Per the Atlassian documentation, as the replacement for the Align and Center macros. |
As ADF (Confluence Cloud)
The ADF that Confluence Cloud builds for:
<p style="text-align: center;">centered text</p>
{
"type": "doc",
"content": [
{
"type": "paragraph",
"marks": [
{
"type": "alignment",
"attrs": {
"align": "center"
}
}
],
"content": [
{
"text": "centered text",
"type": "text"
}
]
}
],
"version": 1
}
Examples
Storage format sent
<p style="text-align: center;">centered text</p>Centered paragraph as written in the documentation. The ADF mark has the align value center.
Rendered view (HTML)
<p style="text-align: center;">centered text</p>Storage format after the round trip through ADF
<p style="text-align: center;">centered text</p>Sent to Confluence Cloud on .
Storage format sent
<p style="text-align: right;">right aligned text</p>Right-aligned paragraph. In ADF the same alignment is the value end.
Rendered view (HTML)
<p style="text-align: right;">right aligned text</p>Storage format after the round trip through ADF
<p style="text-align: right;">right aligned text</p>Sent to Confluence Cloud on .
Storage format sent
<p style="margin-left: 30.0px;">indented</p>A first level of indent, 30 pixels, kept in storage with one decimal place.
Rendered view (HTML)
<p style="margin-left: 30.0px;">indented</p>Storage format after the round trip through ADF
<p style="margin-left: 30.0px;">indented</p>Sent to Confluence Cloud on .
Storage format sent
ADF:{"content": [{"content": [{"text": "Indented twice", "type": "text"}], "marks": [{"attrs": {"level": 2}, "type": "indentation"}], "type": "paragraph"}], "type": "doc", "version": 1}An ADF paragraph with indentation level 2. Confluence writes a margin-left of 60 pixels.
Rendered view (HTML)
<p style="margin-left: 60.0px;">Indented twice</p>Storage format after the round trip through ADF
<p style="margin-left: 60.0px;">Indented twice</p>Sent to Confluence Cloud on .
Storage format sent
ADF:{"content": [{"attrs": {"level": 2}, "content": [{"text": "Centered", "type": "text"}], "marks": [{"attrs": {"align": "center"}, "type": "alignment"}], "type": "heading"}], "type": "doc", "version": 1}Alignment on a heading set in ADF. It is written as a text-align style on the heading element.
Rendered view (HTML)
<h2 style="text-align: center;" id="Examplepage-Centered">Centered</h2>Storage format after the round trip through ADF
<h2 style="text-align: center;">Centered</h2>Sent to Confluence Cloud on .
Storage format sent
<ac:structured-macro ac:name="align"><ac:parameter ac:name="alignment">center</ac:parameter><ac:rich-text-body><p>align body</p></ac:rich-text-body></ac:structured-macro>The legacy align macro. It survives an ADF save, but the view shows text-align: justify for the value center.
Rendered view (HTML)
<div class="conf-macro output-block" data-hasbody="true" data-macro-id="<id>" data-macro-name="align" style="text-align: justify;"><p>align body</p></div>Storage format after the round trip through ADF
<ac:structured-macro ac:name="align" ac:schema-version="1" ac:macro-id="<id>"><ac:parameter ac:name="alignment">center</ac:parameter><ac:rich-text-body><p>align body</p></ac:rich-text-body></ac:structured-macro>Sent to Confluence Cloud on .
Storage format sent
<ac:structured-macro ac:name="center"><ac:rich-text-body><p>center body</p></ac:rich-text-body></ac:structured-macro>The legacy center macro. It survives as a macro and renders with text-align: center.
Rendered view (HTML)
<div class="conf-macro output-block" data-hasbody="true" data-macro-id="<id>" data-macro-name="center" style="text-align:center;"><p>center body</p></div>Storage format after the round trip through ADF
<ac:structured-macro ac:name="center" ac:schema-version="1" ac:macro-id="<id>"><ac:rich-text-body><p>center body</p></ac:rich-text-body></ac:structured-macro>Sent to Confluence Cloud on .
What changes in conversion
- text-align on a paragraph or heading maps to the ADF alignment mark. center stays center and right is stored in ADF as end. All are written back as the same style.
- margin-left in multiples of 30 pixels maps to the ADF indentation mark, one level per 30 pixels. Level 2 is stored as margin-left: 60.0px.
- The align and center macros remain macros with their body after the ADF round trip, which matches the removed-macros page.
Pitfalls
- Only centre and right alignment were probed. Left alignment was not tested.
- Prefer the style to the macros. The documentation points to the toolbar alignment options as the replacement for both macros.
- The align macro with alignment set to center rendered as justify in the probe, so check the value list before relying on it.
Questions and answers
How is a right-aligned paragraph stored in ADF?
As an alignment mark with the value end. Storage writes it back as text-align: right.
Related
- <h1> to <h6> headings
- Paragraphs, line breaks and <hr>
- <blockquote>
- Macros removed from the Cloud editor
- <ul> and <ol> lists