Going Stellar

Home/Confluence storage format reference

Confluence storage format

Table width, layout and number column in storage format

Cloud tables carry a layout (default, wide or full-width) and optional pixel widths through data-layout, data-table-width and a colgroup. A percentage width written with the older relative-table class is stored but not carried into ADF. The numbered column is an ADF setting that appears in storage as numbering cells.

Storage format

<table data-layout="wide" data-table-width="1200">
<colgroup><col style="width: 200px;" /><col style="width: 400px;" /></colgroup>
<th class="numberingColumn" />

As ADF (Confluence Cloud)

The ADF that Confluence Cloud builds for:

ADF:{"content": [{"attrs": {"isNumberColumnEnabled": true, "layout": "wide"}, "content": [{"content": [{"content": [{"content": [{"text": "H1", "type": "text"}], "type": "paragraph"}], "type": "tableHeader"}, {"content": [{"content": [{"text": "H2", "type": "text"}], "type": "paragraph"}], "type": "tableHeader"}], "type": "tableRow"}, {"content": [{"attrs": {"colspan": 2}, "content": [{"content": [{"text": "merged", "type": "text"}], "type": "paragraph"}], "type": "tableCell"}], "type": "tableRow"}, {"content": [{"attrs": {"background": "#deebff"}, "content": [{"content": [{"text": "bg", "type": "text"}], "type": "paragraph"}], "type": "tableCell"}, {"content": [{"content": [{"text": "x", "type": "text"}], "type": "paragraph"}], "type": "tableCell"}], "type": "tableRow"}], "type": "table"}], "type": "doc", "version": 1}
{
 "type": "doc",
 "content": [
  {
   "type": "table",
   "attrs": {
    "layout": "wide",
    "isNumberColumnEnabled": true
   },
   "content": [
    {
     "type": "tableRow",
     "content": [
      {
       "type": "tableHeader",
       "attrs": {
        "colspan": 1,
        "rowspan": 1
       },
       "content": [
        {
         "type": "paragraph",
         "content": [
          {
           "text": "H1",
           "type": "text"
          }
         ]
        }
       ]
      },
      {
       "type": "tableHeader",
       "attrs": {
        "colspan": 1,
        "rowspan": 1
       },
       "content": [
        {
         "type": "paragraph",
         "content": [
          {
           "text": "H2",
           "type": "text"
          }
         ]
        }
       ]
      }
     ]
    },
    {
     "type": "tableRow",
     "content": [
      {
       "type": "tableCell",
       "attrs": {
        "colspan": 2,
        "rowspan": 1
       },
       "content": [
        {
         "type": "paragraph",
         "content": [
          {
           "text": "merged",
           "type": "text"
          }
         ]
        }
       ]
      }
     ]
    },
    {
     "type": "tableRow",
     "content": [
      {
       "type": "tableCell",
       "attrs": {
        "colspan": 1,
        "background": "#deebff",
        "rowspan": 1
       },
       "content": [
        {
         "type": "paragraph",
         "content": [
          {
           "text": "bg",
           "type": "text"
          }
         ]
        }
       ]
      },
      {
       "type": "tableCell",
       "attrs": {
        "colspan": 1,
        "rowspan": 1
       },
       "content": [
        {
         "type": "paragraph",
         "content": [
          {
           "text": "x",
           "type": "text"
          }
         ]
        }
       ]
      }
     ]
    }
   ]
  }
 ],
 "version": 1
}

Examples

Storage format sent

<table data-layout="wide" data-table-width="1200"><colgroup><col style="width: 200px;" /><col style="width: 400px;" /></colgroup><tbody><tr><td>a</td><td>b</td></tr></tbody></table>

A wide table with an explicit total width and two column widths.

Rendered view (HTML)

<div class="table-wrap"><table data-layout="wide" data-table-width="1200" class="confluenceTable"><colgroup><col style="width: 200.0px;"/><col style="width: 400.0px;"/></colgroup><tbody><tr><td class="confluenceTd">a</td><td class="confluenceTd">b</td></tr></tbody></table></div>

Storage format after the round trip through ADF

<table data-table-width="1200.0" data-layout="wide"><colgroup><col style="width: 200.0px;" /><col style="width: 400.0px;" /></colgroup><tbody><tr><td><p>a</p></td><td><p>b</p></td></tr></tbody></table>

Sent to Confluence Cloud on .

Storage format sent

<table class="relative-table" style="width: 50%;"><tbody><tr><td>half width</td></tr></tbody></table>

A table sized as a percentage with the older relative-table class and a style width.

Rendered view (HTML)

<div class="table-wrap"><table class="relative-table confluenceTable" style="width: 50.0%;"><tbody><tr><td class="confluenceTd">half width</td></tr></tbody></table></div>

Storage format after the round trip through ADF

<table data-layout="default"><tbody><tr><td><p>half width</p></td></tr></tbody></table>

Sent to Confluence Cloud on .

Storage format sent

<table data-number-column="true"><tbody><tr><th>H</th></tr><tr><td>numbered</td></tr></tbody></table>

A table that asks for a number column with data-number-column, an attribute the Cloud editor does not use.

Rendered view (HTML)

<div class="table-wrap"><table class="confluenceTable"><tbody><tr><th class="confluenceTh">H</th></tr><tr><td class="confluenceTd">numbered</td></tr></tbody></table></div>

Storage format after the round trip through ADF

<table data-layout="default"><tbody><tr><th><p>H</p></th></tr><tr><td><p>numbered</p></td></tr></tbody></table>

Sent to Confluence Cloud on .

Storage format sent

ADF:{"content": [{"attrs": {"isNumberColumnEnabled": true, "layout": "wide"}, "content": [{"content": [{"content": [{"content": [{"text": "H1", "type": "text"}], "type": "paragraph"}], "type": "tableHeader"}, {"content": [{"content": [{"text": "H2", "type": "text"}], "type": "paragraph"}], "type": "tableHeader"}], "type": "tableRow"}, {"content": [{"attrs": {"colspan": 2}, "content": [{"content": [{"text": "merged", "type": "text"}], "type": "paragraph"}], "type": "tableCell"}], "type": "tableRow"}, {"content": [{"attrs": {"background": "#deebff"}, "content": [{"content": [{"text": "bg", "type": "text"}], "type": "paragraph"}], "type": "tableCell"}, {"content": [{"content": [{"text": "x", "type": "text"}], "type": "paragraph"}], "type": "tableCell"}], "type": "tableRow"}], "type": "table"}], "type": "doc", "version": 1}

The numbered column the way the Cloud editor creates it, from an ADF table with isNumberColumnEnabled and a wide layout.

Rendered view (HTML)

<div class="table-wrap"><table data-layout="wide" class="confluenceTable"><colgroup><col/></colgroup><tbody><tr><th class="numberingColumn confluenceTh" /><th class="confluenceTh"><p>H1</p></th><th class="confluenceTh"><p>H2</p></th></tr><tr><td class="numberingColumn confluenceTd">1</td><td colspan="2" class="confluenceTd"><p>merged</p></td></tr><tr><td class="numberingColumn confluenceTd">2</td><td data-highlight-colour="#deebff" class="confluenceTd"><p>bg</p></td><td class="confluenceTd"><p>x</p></td></tr></tbody></table></div>

Storage format after the round trip through ADF

<table data-layout="wide"><colgroup><col /></colgroup><tbody><tr><th class="numberingColumn" /><th><p>H1</p></th><th><p>H2</p></th></tr><tr><td class="numberingColumn">1</td><td colspan="2"><p>merged</p></td></tr><tr><td class="numberingColumn">2</td><td data-highlight-colour="#deebff"><p>bg</p></td><td><p>x</p></td></tr></tbody></table>

Sent to Confluence Cloud on .

What changes in conversion

  • data-layout="wide" and data-table-width are kept. Column widths in the colgroup are rewritten as decimals (200px becomes 200.0px) and map to colwidth values in ADF.
  • A relative-table with style="width: 50%" is stored as 50.0% and rendered, but the ADF round trip returns a default-layout table without the width.
  • data-number-column="true" is dropped the moment the page is saved. It never reaches the stored storage format.
  • A number column created from ADF is stored as an empty th with class numberingColumn in the header row, a td with that class and the row number in every other row, and a colgroup holding a single col.

Pitfalls

  • Percentage widths do not survive the editor. Express the width with data-layout and pixel values instead.
  • Do not write numbering cells by hand. Turn on the number column from the editor or send isNumberColumnEnabled in ADF and let Confluence write the class cells.
  • The numbering cells hold real text (1, 2, ...) in storage. Scripts that read the first column of a table must skip them.

Questions and answers

What are the layout values?

The runs used default and wide. Other layout names were not probed.

Sources

  1. Confluence storage format (Atlassian Documentation)
  2. Atlassian Document Format: document structure (Atlassian Developer)
  3. Confluence Cloud REST API v1: content (Atlassian Developer)

Markdown version · All storage format pages