Going Stellar

Home/Confluence storage format reference

Confluence storage format

Text highlight (background-color) in Confluence storage

Text highlight is a span with a background-color style, which maps to the ADF backgroundColor mark. The highlight macro survives as a macro. The bgcolor macro is converted to a panel macro by an ADF save.

Storage format

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

In the editor

HowNote
Use the highlighting feature in the editor toolbarPer the Atlassian documentation, as the replacement for the Highlight macro.

As ADF (Confluence Cloud)

The ADF that Confluence Cloud builds for:

<p><span style="background-color: rgb(254,222,200);">highlight</span></p>
{
 "type": "doc",
 "content": [
  {
   "type": "paragraph",
   "content": [
    {
     "text": "highlight",
     "type": "text",
     "marks": [
      {
       "type": "backgroundColor",
       "attrs": {
        "color": "#fedec8"
       }
      }
     ]
    }
   ]
  }
 ],
 "version": 1
}

Examples

Storage format sent

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

Inline highlight with an rgb background. The span comes back unchanged and the ADF colour is the hex equivalent.

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 .

Storage format sent

ADF:{"content": [{"content": [{"marks": [{"type": "strong"}], "text": "b", "type": "text"}, {"text": " ", "type": "text"}, {"marks": [{"type": "underline"}], "text": "u", "type": "text"}, {"text": " ", "type": "text"}, {"marks": [{"type": "strike"}], "text": "s", "type": "text"}, {"text": " ", "type": "text"}, {"marks": [{"type": "code"}], "text": "c", "type": "text"}, {"text": " ", "type": "text"}, {"marks": [{"attrs": {"type": "sup"}, "type": "subsup"}], "text": "sup", "type": "text"}, {"text": " ", "type": "text"}, {"marks": [{"attrs": {"color": "#ff5630"}, "type": "textColor"}], "text": "red", "type": "text"}, {"text": " ", "type": "text"}, {"marks": [{"attrs": {"color": "#fedec8"}, "type": "backgroundColor"}], "text": "hl", "type": "text"}], "type": "paragraph"}], "type": "doc", "version": 1}

A hex backgroundColor mark in ADF is stored as an rgb background-color span.

Rendered view (HTML)

<p><style>[data-colorid=ygsqugo5p0]{color:#ff5630} html[data-color-mode=dark] [data-colorid=ygsqugo5p0]{color:#cf2600}</style><strong>b</strong> <u>u</u> <del>s</del> <code>c</code> <sup>sup</sup> <span data-colorid="ygsqugo5p0">red</span> <span style="background-color: rgb(254,222,200);">hl</span></p>

Storage format after the round trip through ADF

<p><strong>b</strong> <u>u</u> <del>s</del> <code>c</code> <sup>sup</sup> <span style="color: rgb(255,86,48);">red</span> <span style="background-color: rgb(254,222,200);">hl</span></p>

Sent to Confluence Cloud on .

Storage format sent

<ac:structured-macro ac:name="highlight"><ac:parameter ac:name="colour">yellow</ac:parameter><ac:rich-text-body><p>highlight body</p></ac:rich-text-body></ac:structured-macro>

The legacy highlight macro with a colour parameter. It is kept as a macro and renders as an inline block with a yellow background.

Rendered view (HTML)

<div class="conf-macro output-inline" data-hasbody="true" data-macro-id="<id>" data-macro-name="highlight" style="display: inline-block; background-color: yellow">
    highlight body
</div>

Storage format after the round trip through ADF

<ac:structured-macro ac:name="highlight" ac:schema-version="1" ac:macro-id="<id>"><ac:parameter ac:name="colour">yellow</ac:parameter><ac:rich-text-body><p>highlight body</p></ac:rich-text-body></ac:structured-macro>

Sent to Confluence Cloud on .

Storage format sent

<ac:structured-macro ac:name="bgcolor"><ac:parameter ac:name="colour">yellow</ac:parameter><ac:rich-text-body><p>bgcolor body</p></ac:rich-text-body></ac:structured-macro>

The legacy bgcolor macro. The view shows a pale green background, and an ADF save rewrites it as a panel macro.

Rendered view (HTML)

<div class="conf-macro output-block" data-hasbody="true" data-macro-id="<id>" data-macro-name="bgcolor" style="background-color: #C0FFC0;">
    bgcolor body
</div>

Storage format after the round trip through ADF

<ac:structured-macro ac:name="panel" ac:schema-version="1" ac:macro-id="<id>"><ac:parameter ac:name="containerLevel">panel_c1</ac:parameter><ac:parameter ac:name="bgColor">#C0FFC0</ac:parameter><ac:rich-text-body><p>bgcolor body</p></ac:rich-text-body></ac:structured-macro>

Sent to Confluence Cloud on .

What changes in conversion

  • background-color on a span maps to the backgroundColor mark. rgb(254,222,200) becomes #fedec8 and is written back in the same rgb form.
  • The highlight macro is kept with its colour parameter and body, matching the statement that existing macros stay visible and editable.
  • bgcolor does not stay a macro. The ADF save produces a panel macro with containerLevel panel_c1 and a bgColor parameter of #C0FFC0, and the view adds a border.

Where the documentation differs

  • <ac:structured-macro ac:name="bgcolor"><ac:parameter ac:name="colour">yellow</ac:parameter><ac:rich-text-body><p>bgcolor body</p></ac:rich-text-body></ac:structured-macro>

    Sent to Confluence Cloud, . The documentation: The removed-macros page says Background color macros are still visible and editable after conversion, without any loss of data.

    The actual result: After an ADF save the bgcolor macro no longer exists. It is a panel macro, the colour parameter is gone, and the content is shown in a bordered panel instead of a plain coloured block.

Pitfalls

  • Do not expect a colour name in the bgcolor macro to keep its meaning. The probe with yellow rendered as #C0FFC0, and the converted panel holds that hex value.
  • Highlighting through the macro and highlighting through the span are separate things. Searches for one miss the other.

Questions and answers

Does the highlight macro survive the Cloud editor?

An existing highlight macro does. It was returned with the same colour parameter and body after an ADF save.

Sources

  1. Confluence storage format (Atlassian Documentation)
  2. Atlassian Document Format: document structure (Atlassian Developer)
  3. Macros that are unavailable or have limited availability in the Cloud editor (Atlassian Support)

Markdown version · All storage format pages