# Link bodies: plain text and rich in Confluence storage

URL: https://goingstellar.ro/reference/confluence-storage-format/link-bodies/

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

```xml
<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:

```xml
<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>
```

```json
{
 "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:

```xml
<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):

```html
<p><a class="unresolved" href="#">Some <strong>Rich</strong> Text</a></p>
```

Storage format after the round trip through ADF:

```xml
<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 29 Nov 2026.

Storage format sent:

```xml
<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):

```html
<p><a class="unresolved" href="#">A plain &lt;text&gt; link body</a></p>
```

Storage format after the round trip through ADF:

```xml
<p><a href="https://your-site.atlassian.net/wiki/pages/createpage.action?spaceKey=TECHWRITING&amp;title=Plugin%20developer%20tutorial%20stuff">A plain &lt;text&gt; link body</a></p>
```

Sent to Confluence Cloud on 29 Nov 2026.

Storage format sent:

```xml
<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):

```html
<p><a class="unresolved" href="#">Plugin developer tutorial stuff</a></p>
```

Storage format after the round trip through ADF:

```xml
<p><a href="https://your-site.atlassian.net/wiki/pages/createpage.action?spaceKey=TECHWRITING&amp;title=Plugin%20developer%20tutorial%20stuff">Plugin developer tutorial stuff</a></p>
```

Sent to Confluence Cloud on 29 Nov 2026.

## 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.

## Related

- [<ac:link> to a page](https://goingstellar.ro/reference/confluence-storage-format/page-links/)
- [Anchor links](https://goingstellar.ro/reference/confluence-storage-format/anchor-links/)
- [<a href> external links](https://goingstellar.ro/reference/confluence-storage-format/external-links/)
- [Links to attachments](https://goingstellar.ro/reference/confluence-storage-format/attachment-links/)
- [<ac:image> from a URL](https://goingstellar.ro/reference/confluence-storage-format/external-images/)

## Sources

- [Confluence storage format (Atlassian Documentation)](https://confluence.atlassian.com/doc/confluence-storage-format-790796544.html)
- [Atlassian Document Format: document structure (Atlassian Developer)](https://developer.atlassian.com/cloud/jira/platform/apis/document/structure/)

