Going Stellar

Home/Confluence storage format reference

Confluence storage format

html, iframe and widget macros in Confluence storage format

The html macro holds raw HTML in a plain-text body, the iframe macro embeds a web page, and the widget macro embeds a video or similar external item. In the probes only the html macro could be saved, and its output was not rendered.

Storage format

<ac:structured-macro ac:name="html"><ac:plain-text-body><![CDATA[<b>raw html</b>]]></ac:plain-text-body></ac:structured-macro>
<ac:structured-macro ac:name="iframe"><ac:parameter ac:name="src">https://example.com</ac:parameter></ac:structured-macro>
<ac:structured-macro ac:name="widget"><ac:parameter ac:name="url">https://www.youtube.com/watch?v=dQw4w9WgXcQ</ac:parameter></ac:structured-macro>

In the editor

HowNote
Use the + toolbar button, find the iFrame macro by name, then fill in the configuration panelPer the Atlassian documentation.
Paste a YouTube or Vimeo URL; Confluence converts it to the widget connector macroPer the Atlassian documentation.

As ADF (Confluence Cloud)

The ADF that Confluence Cloud builds for:

<ac:structured-macro ac:name="html"><ac:plain-text-body><![CDATA[<b>raw html</b>]]></ac:plain-text-body></ac:structured-macro>
{
 "type": "doc",
 "content": [
  {
   "type": "extension",
   "attrs": {
    "extensionType": "com.atlassian.confluence.macro.core",
    "extensionKey": "html",
    "parameters": {
     "macroParams": {
      "_parentId": {
       "value": "<page id>"
      },
      "__bodyContent": {
       "value": "<b>raw html</b>"
      }
     },
     "macroMetadata": {
      "macroId": {
       "value": "<id>"
      },
      "schemaVersion": {
       "value": "1"
      },
      "title": "html"
     }
    }
   }
  }
 ],
 "version": 1
}

Examples

Storage format sent

<ac:structured-macro ac:name="html"><ac:plain-text-body><![CDATA[<b>raw html</b>]]></ac:plain-text-body></ac:structured-macro>

Stores a snippet of raw HTML in the macro body. The page saved, but the view is the unknown-macro placeholder, so the HTML is not shown.

Rendered view (HTML)

<img class="wysiwyg-unknown-macro" src="https://your-site.atlassian.net/wiki/plugins/servlet/confluence/placeholder/unknown-macro?name=html&amp;locale=en_US&amp;version=2" />

Storage format after the round trip through ADF

<ac:structured-macro ac:name="html" ac:schema-version="1" ac:macro-id="<id>"><ac:parameter ac:name="_parentId"><page id></ac:parameter><ac:plain-text-body><![CDATA[<b>raw html</b>]]></ac:plain-text-body></ac:structured-macro>

Sent to Confluence Cloud on .

Storage format sent

<p><script>alert(1)</script>after script</p>

A script element placed in a normal paragraph. Confluence removed the script and its content when the page was saved.

Rendered view (HTML)

<p>after script</p>

Storage format after the round trip through ADF

<p>after script</p>

Sent to Confluence Cloud on .

Storage format sent

<div><p>in a div</p></div>

A plain div element wrapped around a paragraph. Storage keeps the div, and the ADF round trip removes it.

Rendered view (HTML)

<div><p>in a div</p></div>

Storage format after the round trip through ADF

<p>in a div</p>

Sent to Confluence Cloud on .

Storage format sent

<ac:structured-macro ac:name="div"><ac:rich-text-body><p>div body</p></ac:rich-text-body></ac:structured-macro>

The legacy div macro, which wraps a body in a div. The body survives as a bodiedExtension, but the view is a plain conf-macro div, with no attributes from the macro.

Rendered view (HTML)

<div class="conf-macro output-block" data-hasbody="true" data-macro-id="<id>" data-macro-name="div">
    div body
</div>

Storage format after the round trip through ADF

<ac:structured-macro ac:name="div" ac:schema-version="1" ac:macro-id="<id>"><ac:rich-text-body><p>div body</p></ac:rich-text-body></ac:structured-macro>

Sent to Confluence Cloud on .

Storage format sent

<ac:structured-macro ac:name="style"><ac:rich-text-body><p>style body</p></ac:rich-text-body></ac:structured-macro>

The legacy style macro with a paragraph as its body. Confluence dropped the body at the first save, and the view is an empty @media rule.

Rendered view (HTML)

<style class="conf-macro output-block" data-hasbody="false" data-macro-id="<id>" data-macro-name="style">@media all {

}</style>

Storage format after the round trip through ADF

<ac:structured-macro ac:name="style" ac:schema-version="1" ac:macro-id="<id>"><ac:parameter ac:name="_parentId"><page id></ac:parameter></ac:structured-macro>

Sent to Confluence Cloud on .

What changes in conversion

  • The html macro body is kept. In ADF it sits in a __bodyContent parameter of an extension node, and on the way back it is written as the same CDATA body.
  • The ADF round trip adds a _parentId parameter to the html and style macros in storage. The page did not carry that parameter before.
  • Raw HTML elements that are not macros (div, script) are not part of ADF. script is removed on save, and a div is removed when the page is converted.

Pitfalls

  • iframe and widget saves failed with HTTP 500. The error message says 'Error writing typed parameter: value is not an instance of ... ResourceIdentifier'. The probes sent src and url as plain text, and no probe tried another form, so the accepted syntax is unknown.
  • The html macro is stored, but body.view is the unknown-macro placeholder. Do not expect the HTML to appear in a read-back of the page.
  • The iframe documentation warns that some websites stay blank in an iFrame when they send the x-frame-options header or when the browser blocks them.

Questions and answers

Why does an iframe macro fail to save?

The probe with src=https://example.com returned status 500 from the content API. The same failure happened for the widget macro with a url parameter.

Can raw HTML be stored through the html macro?

It was stored and returned unchanged, but the rendered view did not show it.

Sources

  1. Confluence storage format (Atlassian Documentation)
  2. Macros that are unavailable or have limited availability in the Cloud editor (Atlassian Support)
  3. Insert the iFrame macro (Atlassian Support)
  4. Insert the widget connector macro (Atlassian Support)

Markdown version · All storage format pages