Going Stellar

Home/Confluence storage format reference

Confluence storage format

Preformatted text (pre, noformat) in Confluence storage

The storage format documentation lists pre for preformatted text. Confluence stores and renders it, but the ADF generated from it is a paragraph with a code mark, so an editor save leaves inline code. The noformat macro is converted to a code macro.

Storage format

<pre>preformatted text</pre>

As ADF (Confluence Cloud)

The ADF that Confluence Cloud builds for:

<ac:structured-macro ac:name="noformat"><ac:plain-text-body><![CDATA[preformatted *no* formatting]]></ac:plain-text-body></ac:structured-macro>
{
 "type": "doc",
 "content": [
  {
   "type": "codeBlock",
   "content": [
    {
     "text": "preformatted *no* formatting",
     "type": "text"
    }
   ]
  }
 ],
 "version": 1
}

Examples

Storage format sent

<pre>preformatted text</pre>

The documented pre element with one line of text. The ADF round trip changes it to a paragraph holding inline code.

Rendered view (HTML)

<pre>preformatted text</pre>

Storage format after the round trip through ADF

<p><code>preformatted text</code></p>

Sent to Confluence Cloud on .

Storage format sent

<ac:structured-macro ac:name="noformat"><ac:plain-text-body><![CDATA[preformatted *no* formatting]]></ac:plain-text-body></ac:structured-macro>

The noformat macro. It renders in a panel, and an ADF save rewrites it as a code macro, shown highlighted as Java in the view.

Rendered view (HTML)

<div class="preformatted panel conf-macro output-block" data-hasbody="true" data-macro-id="<id>" data-macro-name="noformat" style="border-width: 1px;"><div class="preformattedContent panelContent">
<pre>preformatted *no* formatting</pre>
</div></div>

Storage format after the round trip through ADF

<ac:structured-macro ac:name="code" ac:schema-version="1" ac:macro-id="<id>"><ac:plain-text-body><![CDATA[preformatted *no* formatting]]></ac:plain-text-body></ac:structured-macro>

Sent to Confluence Cloud on .

Storage format sent

<ac:structured-macro ac:name="noformat"><ac:parameter ac:name="nopanel">true</ac:parameter><ac:plain-text-body><![CDATA[no panel]]></ac:plain-text-body></ac:structured-macro>

The noformat macro with the nopanel parameter set to true. The view has no panel, and the parameter is gone after the ADF save.

Rendered view (HTML)

<pre class="conf-macro output-block" data-hasbody="true" data-macro-id="<id>" data-macro-name="noformat">no panel</pre>

Storage format after the round trip through ADF

<ac:structured-macro ac:name="code" ac:schema-version="1" ac:macro-id="<id>"><ac:plain-text-body><![CDATA[no panel]]></ac:plain-text-body></ac:structured-macro>

Sent to Confluence Cloud on .

What changes in conversion

  • pre is stored and rendered as pre, but its ADF form is a paragraph with a code mark. After an ADF save the block element is gone, which was seen with a single line of text only.
  • noformat becomes an ADF codeBlock and is written back as a code macro with no language. The view then applies the macro default highlighting, which is Java.
  • The nopanel parameter has no ADF equivalent in the probe. The code macro that comes back has no nopanel parameter.

Where the documentation differs

  • <ac:structured-macro ac:name="noformat"><ac:parameter ac:name="nopanel">true</ac:parameter><ac:plain-text-body><![CDATA[no panel]]></ac:plain-text-body></ac:structured-macro>

    Sent to Confluence Cloud, . The documentation: The removed-macros page says Noformat macros automatically become native Code snippet elements, and that existing macros migrate without any loss of data.

    The actual result: The macro does become a code macro, but the nopanel parameter set to true is dropped. A block that rendered with no panel comes back inside a panel.

Pitfalls

  • Do not use pre for a block that must keep its line breaks and monospace look after an editor save. Use the code macro.
  • After conversion the view marks the block with the java brush, because the code macro was created without a language.

Questions and answers

Does Confluence Cloud keep a pre element?

Storage keeps it, but an ADF save replaced it with a paragraph holding inline code in the probe.

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