Home/Confluence storage format reference
Confluence storage format
Link bodies: plain text and rich in Confluence storage
The text of an ac:link comes from ac:plain-text-link-body, which holds CDATA, or from ac:link-body, which holds a small set of inline markup or an image. With neither, Confluence shows the target title. The ADF save turns both into ac:link-body or a plain a href.
Storage format
<ac:link><ri:page ri:content-title="Home" ri:space-key="SANDBOX" /><ac:link-body>Some <strong>Rich</strong> Text</ac:link-body></ac:link>
<ac:link><ri:page ri:content-title="Plugin developer tutorial stuff" ri:space-key="TECHWRITING" /><ac:plain-text-link-body><![CDATA[A plain <text> link body]]></ac:plain-text-link-body></ac:link>
As ADF (Confluence Cloud)
The ADF that Confluence Cloud builds for:
<p><ac:link><ri:page ri:content-title="Home" ri:space-key="SANDBOX" /><ac:link-body>Some <strong>Rich</strong> Text</ac:link-body></ac:link></p>
{
"type": "doc",
"content": [
{
"type": "paragraph",
"content": [
{
"text": "Some ",
"type": "text",
"marks": [
{
"type": "link",
"attrs": {
"__confluenceMetadata": {
"spaceKey": "SANDBOX",
"isRenamedTitle": true,
"linkType": "page",
"contentTitle": "Home"
},
"href": "https://your-site.atlassian.net/wiki/pages/createpage.action?spaceKey=SANDBOX&title=Home"
}
}
]
},
{
"text": "Rich",
"type": "text",
"marks": [
{
"type": "strong"
},
{
"type": "link",
"attrs": {
"__confluenceMetadata": {
"spaceKey": "SANDBOX",
"isRenamedTitle": true,
"linkType": "page",
"contentTitle": "Home"
},
"href": "https://your-site.atlassian.net/wiki/pages/createpage.action?spaceKey=SANDBOX&title=Home"
}
}
]
},
{
"text": " Text",
"type": "text",
"marks": [
{
"type": "link",
"attrs": {
"__confluenceMetadata": {
"spaceKey": "SANDBOX",
"isRenamedTitle": true,
"linkType": "page",
"contentTitle": "Home"
},
"href": "https://your-site.atlassian.net/wiki/pages/createpage.action?spaceKey=SANDBOX&title=Home"
}
}
]
}
]
}
],
"version": 1
}
Examples
Storage format sent
<p><ac:link><ri:page ri:content-title="Home" ri:space-key="SANDBOX" /><ac:link-body>Some <strong>Rich</strong> Text</ac:link-body></ac:link></p>A link body with bold text in the middle, from the documentation.
Rendered view (HTML)
<p><a class="unresolved" href="#">Some <strong>Rich</strong> Text</a></p>Storage format after the round trip through ADF
<p><ac:link><ri:page ri:space-key="SANDBOX" ri:content-title="Home" /><ac:link-body>Some <strong>Rich</strong> Text</ac:link-body></ac:link></p>Sent to Confluence Cloud on .
Storage format sent
<p><ac:link><ri:page ri:content-title="Plugin developer tutorial stuff" ri:space-key="TECHWRITING" /><ac:plain-text-link-body><![CDATA[A plain <text> link body]]></ac:plain-text-link-body></ac:link></p>A plain-text body that contains angle brackets, protected by CDATA.
Rendered view (HTML)
<p><a class="unresolved" href="#">A plain <text> link body</a></p>Storage format after the round trip through ADF
<p><a href="https://your-site.atlassian.net/wiki/pages/createpage.action?spaceKey=TECHWRITING&title=Plugin%20developer%20tutorial%20stuff">A plain <text> link body</a></p>Sent to Confluence Cloud on .
Storage format sent
<p><ac:link><ri:page ri:content-title="Plugin developer tutorial stuff" ri:space-key="TECHWRITING" /></ac:link></p>A link with no body, from the documentation.
Rendered view (HTML)
<p><a class="unresolved" href="#">Plugin developer tutorial stuff</a></p>Storage format after the round trip through ADF
<p><a href="https://your-site.atlassian.net/wiki/pages/createpage.action?spaceKey=TECHWRITING&title=Plugin%20developer%20tutorial%20stuff">Plugin developer tutorial stuff</a></p>Sent to Confluence Cloud on .
What changes in conversion
- A rich body keeps its bold text. In ADF every text run gets its own link mark, and storage comes back as ac:link with the same ac:link-body.
- A plain-text body with a page target comes back as an a href with the text escaped, so the angle brackets in the sample become entities. The ac:plain-text-link-body wrapper is not kept.
- A link without a body gains the target title as visible text in the ADF save.
- The image body could not be saved back as ADF in this test, since the save was refused with a conflict error. Treat image-in-link as unverified for the round trip.
Pitfalls
- Rich markup in a plain-text-link-body is not interpreted. Tags are shown as text, which is why CDATA is used there.
- The documentation lists the elements allowed in ac:link-body as b, strong, em, i, code, tt, sub, sup, br and span. Other elements were not tested.
- A page that cannot be found is still shown with its body text. The body does not tell you whether the target exists.