Home/Confluence storage format reference
Confluence storage format
Tables in Confluence storage format
A storage format table is plain XHTML: a table element holding rows of th (header) and td (data) cells. Confluence renders it with its own table classes. When the same page is saved from the Cloud editor, each cell is wrapped in a paragraph and the table gains a layout attribute.
Storage format
<table><tbody>
<tr><th>Header 1</th><th>Header 2</th></tr>
<tr><td>Cell 1</td><td>Cell 2</td></tr>
</tbody></table>
As ADF (Confluence Cloud)
The ADF that Confluence Cloud builds for:
<table><tbody><tr><th>Table Heading Cell 1</th><th>Table Heading Cell 2</th></tr><tr><td>Normal Cell 1</td><td>Normal Cell 2</td></tr></tbody></table>
{
"type": "doc",
"content": [
{
"type": "table",
"attrs": {
"__autoSize": true
},
"content": [
{
"type": "tableRow",
"content": [
{
"type": "tableHeader",
"attrs": {
"colspan": 1,
"rowspan": 1
},
"content": [
{
"type": "paragraph",
"content": [
{
"text": "Table Heading Cell 1",
"type": "text"
}
]
}
]
},
{
"type": "tableHeader",
"attrs": {
"colspan": 1,
"rowspan": 1
},
"content": [
{
"type": "paragraph",
"content": [
{
"text": "Table Heading Cell 2",
"type": "text"
}
]
}
]
}
]
},
{
"type": "tableRow",
"content": [
{
"type": "tableCell",
"attrs": {
"colspan": 1,
"rowspan": 1
},
"content": [
{
"type": "paragraph",
"content": [
{
"text": "Normal Cell 1",
"type": "text"
}
]
}
]
},
{
"type": "tableCell",
"attrs": {
"colspan": 1,
"rowspan": 1
},
"content": [
{
"type": "paragraph",
"content": [
{
"text": "Normal Cell 2",
"type": "text"
}
]
}
]
}
]
}
]
}
],
"version": 1
}
Examples
Storage format sent
<table><tbody><tr><th>Table Heading Cell 1</th><th>Table Heading Cell 2</th></tr><tr><td>Normal Cell 1</td><td>Normal Cell 2</td></tr></tbody></table>The two-column, two-row table from the storage format page, with a header row. This is the baseline for every other table entry.
Rendered view (HTML)
<div class="table-wrap"><table class="confluenceTable"><tbody><tr><th class="confluenceTh">Table Heading Cell 1</th><th class="confluenceTh">Table Heading Cell 2</th></tr><tr><td class="confluenceTd">Normal Cell 1</td><td class="confluenceTd">Normal Cell 2</td></tr></tbody></table></div>Storage format after the round trip through ADF
<table data-layout="default"><tbody><tr><th><p>Table Heading Cell 1</p></th><th><p>Table Heading Cell 2</p></th></tr><tr><td><p>Normal Cell 1</p></td><td><p>Normal Cell 2</p></td></tr></tbody></table>Sent to Confluence Cloud on .
Storage format sent
<table><tbody><tr><th>H</th><td>row header column</td></tr></tbody></table>A header cell at the start of a data row, which gives a row header column instead of a header row.
Rendered view (HTML)
<div class="table-wrap"><table class="confluenceTable"><tbody><tr><th class="confluenceTh">H</th><td class="confluenceTd">row header column</td></tr></tbody></table></div>Storage format after the round trip through ADF
<table data-layout="default"><tbody><tr><th><p>H</p></th><td><p>row header column</p></td></tr></tbody></table>Sent to Confluence Cloud on .
Storage format sent
<table><thead><tr><th>Head in thead</th></tr></thead><tbody><tr><td>x</td></tr></tbody></table>A table that wraps its header row in thead. Some generators and older exports emit this structure.
Rendered view (HTML)
<div class="table-wrap"><table class="confluenceTable"><thead><tr><th class="confluenceTh">Head in thead</th></tr></thead><tbody><tr><td class="confluenceTd">x</td></tr></tbody></table></div>Storage format after the round trip through ADF
<table data-layout="default"><tbody><tr><th><p>Head in thead</p></th></tr><tr><td><p>x</p></td></tr></tbody></table>Sent to Confluence Cloud on .
Storage format sent
<ac:structured-macro ac:name="details"><ac:rich-text-body><table><tbody><tr><th>Owner</th><td>Team A</td></tr></tbody></table></ac:rich-text-body></ac:structured-macro>A table inside a Page Properties (details) macro, the usual way to make rows that report macros can read.
Rendered view (HTML)
<div class="plugin-tabmeta-details conf-macro output-block" data-hasbody="true" data-macro-id="<id>" data-macro-name="details"><div class="table-wrap"><table class="confluenceTable"><tbody><tr><th class="confluenceTh">Owner</th><td class="confluenceTd">Team A</td></tr></tbody></table></div></div>Storage format after the round trip through ADF
<ac:structured-macro ac:name="details" ac:schema-version="1" ac:macro-id="<id>"><ac:rich-text-body><table data-layout="default"><tbody><tr><th><p>Owner</p></th><td><p>Team A</p></td></tr></tbody></table></ac:rich-text-body></ac:structured-macro>Sent to Confluence Cloud on .
What changes in conversion
- A table saved from ADF gets data-layout="default" on the table element, and every th and td holds a p element, even when the original cell held bare text.
- A thead element is not kept after the round trip: the header row comes back as the first tr inside tbody, still made of th cells. The rendered page keeps the thead until the page is saved from the editor.
- A th used as the first cell of a data row survives as a th, so row headers are preserved.
- A table inside the details macro stays inside ac:rich-text-body; only the same layout attribute and cell paragraphs are added.
Pitfalls
- Do not rely on thead in tables you write. The editor writes header rows as th cells in tbody, and a thead is gone after the first editor save.
- A table written without p elements in its cells compares as changed after the editor saves the page, because every cell gains a paragraph.
- Rendered output adds the confluenceTable, confluenceTh and confluenceTd classes and a table-wrap div. Do not use those classes in storage.
Questions and answers
Does storage format need thead?
No. The storage format page shows a table with only tbody and th cells in the first row, and that is also what the Cloud editor writes back.
Related
- Merged cells
- Table width, layout and numbered rows
- Lists, paragraphs and tables in cells
- Cell background colours
- details and detailssummary (page properties)