Going Stellar

Home/Confluence storage format reference

Confluence storage format

Table cell background colours in storage format

The Cloud editor stores a cell colour as the data-highlight-colour attribute on the td or th, matching the background attribute of an ADF cell. A background-color written in a style attribute is accepted and rendered, but it does not make it into ADF.

Storage format

<td data-highlight-colour="#deebff">blue cell</td>

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><tbody><tr><td data-highlight-colour="#deebff">blue cell</td><td style="background-color: #ffebe6;">styled cell</td></tr></tbody></table>

Two cells coloured in two ways: the attribute the editor uses, and an inline style. Only one of them survives an editor save.

Rendered view (HTML)

<div class="table-wrap"><table class="confluenceTable"><tbody><tr><td data-highlight-colour="#deebff" class="confluenceTd">blue cell</td><td style="background-color: rgb(255,235,230);" class="confluenceTd">styled cell</td></tr></tbody></table></div>

Storage format after the round trip through ADF

<table data-layout="default"><tbody><tr><td data-highlight-colour="#deebff"><p>blue cell</p></td><td><p>styled cell</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}

A cell coloured from ADF with a background of #deebff, inside a table that also has merged cells and a number column.

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 .

Storage format sent

<p><span style="background-color: rgb(254,222,200);">highlight</span></p>

Text highlight, which is a different feature: a span with a background-color style inside the paragraph, not a coloured cell. It does survive the round trip.

Rendered view (HTML)

<p><span style="background-color: rgb(254,222,200);">highlight</span></p>

Storage format after the round trip through ADF

<p><span style="background-color: rgb(254,222,200);">highlight</span></p>

Sent to Confluence Cloud on .

What changes in conversion

  • data-highlight-colour is kept as written, and ADF holds the same hex value in the cell background attribute.
  • A td with style="background-color: #ffebe6;" is rewritten when stored: the value comes back as rgb(255,235,230) and renders as a coloured cell.
  • After the ADF round trip the inline style on the cell is gone and the cell has no colour, because the converter reads only data-highlight-colour.
  • Text highlight is a separate mark. A span with a background-color style round trips unchanged, as a backgroundColor mark in ADF.

Pitfalls

  • Use data-highlight-colour on cells and keep style="background-color" for spans of text. A styled cell looks right until the next editor save.
  • The attribute takes a hex value. The stored form of an inline style uses rgb(), so the two forms are not interchangeable in comparisons.

Sources

  1. Confluence storage format (Atlassian Documentation)
  2. Atlassian Document Format: document structure (Atlassian Developer)

Markdown version · All storage format pages