Going Stellar

Home/Confluence storage format reference

Confluence storage format

<a href> external links in Confluence storage format

Links to other sites use a standard a element with an href, with no ac: or ri: markup. Confluence adds the external-link class and rel nofollow in the view. An ADF save keeps the href and the text, and drops the title attribute and the target.

Storage format

<a href="http://www.atlassian.com">Atlassian</a>
<a href="mailto:someone@example.com">mail</a>

As ADF (Confluence Cloud)

The ADF that Confluence Cloud builds for:

<p><a href="http://www.atlassian.com">Atlassian</a></p>
{
 "type": "doc",
 "content": [
  {
   "type": "paragraph",
   "content": [
    {
     "text": "Atlassian",
     "type": "text",
     "marks": [
      {
       "type": "link",
       "attrs": {
        "href": "http://www.atlassian.com"
       }
      }
     ]
    }
   ]
  }
 ],
 "version": 1
}

Examples

Storage format sent

<p><a href="http://www.atlassian.com">Atlassian</a></p>

The external link example from the storage format page.

Rendered view (HTML)

<p><a class="external-link" href="http://www.atlassian.com" rel="nofollow">Atlassian</a></p>

Storage format after the round trip through ADF

<p><a href="http://www.atlassian.com">Atlassian</a></p>

Sent to Confluence Cloud on .

Storage format sent

<p><a href="https://example.com" title="Tooltip">titled link</a></p>

A link with a title attribute meant as a tooltip.

Rendered view (HTML)

<p><a class="external-link" href="https://example.com" rel="nofollow" title="Tooltip">titled link</a></p>

Storage format after the round trip through ADF

<p><a href="https://example.com">titled link</a></p>

Sent to Confluence Cloud on .

Storage format sent

<p><a href="https://example.com" target="_blank">new tab</a></p>

A link that is supposed to open in a new tab.

Rendered view (HTML)

<p><a class="external-link" href="https://example.com" rel="nofollow">new tab</a></p>

Storage format after the round trip through ADF

<p><a href="https://example.com">new tab</a></p>

Sent to Confluence Cloud on .

Storage format sent

<p><a href="mailto:someone@example.com">mail</a></p>

A mailto link.

Rendered view (HTML)

<p><a class="external-link" href="mailto:someone@example.com" rel="nofollow">mail</a></p>

Storage format after the round trip through ADF

<p><a href="mailto:someone@example.com">mail</a></p>

Sent to Confluence Cloud on .

Storage format sent

<p><a href="https://example.com"><strong>bold link</strong></a></p>

A link whose text is bold, with the strong element inside the a element.

Rendered view (HTML)

<p><a class="external-link" href="https://example.com" rel="nofollow"><strong>bold link</strong></a></p>

Storage format after the round trip through ADF

<p><strong><a href="https://example.com">bold link</a></strong></p>

Sent to Confluence Cloud on .

What changes in conversion

  • The href and the link text round-trip unchanged for http, https and mailto addresses.
  • A title attribute is kept in storage and in the view, but the ADF link mark has no title in this test, so a save from the Cloud editor removes it.
  • A target attribute is removed the first time the content is stored. Reading it back through storage already shows no target.
  • A strong element inside the a element comes back reversed, as a link inside strong. The page looks the same.

Pitfalls

  • The view adds rel="nofollow" to external links. That attribute is output by Confluence and cannot be changed from the markup.
  • A new-tab link cannot be written in storage format, because target is discarded on save.
  • A link to an address on the same Confluence site is still an a href, not a page link, and it breaks when pages are moved or renamed.

Sources

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

Markdown version · All storage format pages