Going Stellar

Home/Confluence storage format reference

Confluence storage format

User links and mentions in Confluence storage format

An @mention is stored as an ac:link with a ri:user child that carries ri:account-id. The ADF form is a mention node with the same id. A legacy ri:userkey is accepted and is rewritten into an account id with a userkey- prefix.

Storage format

<ac:link><ri:user ri:account-id="<accountId>" /></ac:link>
<ac:structured-macro ac:name="profile"><ac:parameter ac:name="user"><ri:user ri:account-id="<accountId>" /></ac:parameter></ac:structured-macro>

As ADF (Confluence Cloud)

The ADF that Confluence Cloud builds for:

ADF:{"content": [{"content": [{"attrs": {"id": "<accountId>", "text": "@someone"}, "type": "mention"}], "type": "paragraph"}], "type": "doc", "version": 1}
{
 "type": "doc",
 "content": [
  {
   "type": "paragraph",
   "content": [
    {
     "type": "mention",
     "attrs": {
      "id": "<accountId>",
      "text": "@<display name>"
     }
    }
   ]
  }
 ],
 "version": 1
}

Examples

Storage format sent

<p><ac:link><ri:user ri:account-id="<accountId>" /></ac:link></p>

A mention of a person by account id, written in storage.

Rendered view (HTML)

<macro output not published: it lists pages, tasks or people from the site>

Storage format after the round trip through ADF

<p><ac:link><ri:user ri:account-id="<accountId>" /></ac:link></p>

Sent to Confluence Cloud on .

Storage format sent

ADF:{"content": [{"content": [{"attrs": {"id": "<accountId>", "text": "@someone"}, "type": "mention"}], "type": "paragraph"}], "type": "doc", "version": 1}

A mention node sent as ADF, to see the storage that Confluence writes for it.

Rendered view (HTML)

<macro output not published: it lists pages, tasks or people from the site>

Storage format after the round trip through ADF

<p><ac:link><ri:user ri:account-id="<accountId>" /></ac:link></p>

Sent to Confluence Cloud on .

Storage format sent

<p><ac:link><ri:user ri:userkey="2c9680f7405147ee0140514c26120003"/></ac:link></p>

A mention using the old userkey attribute, as found in older content.

Rendered view (HTML)

<macro output not published: it lists pages, tasks or people from the site>

Storage format after the round trip through ADF

<p><ac:link><ri:user ri:account-id="userkey-2c9680f7405147ee0140514c26120003" /></ac:link></p>

Sent to Confluence Cloud on .

Storage format sent

<ac:structured-macro ac:name="profile"><ac:parameter ac:name="user"><ri:user ri:account-id="<accountId>" /></ac:parameter></ac:structured-macro>

The user profile macro, which takes the same ri:user element as a parameter.

Rendered view (HTML)

<macro output not published: it lists pages, tasks or people from the site>

Storage format after the round trip through ADF

<ac:structured-macro ac:name="profile" ac:schema-version="1" ac:macro-id="<id>"><ac:parameter ac:name="user"><ri:user ri:account-id="<accountId>" /></ac:parameter></ac:structured-macro>

Sent to Confluence Cloud on .

What changes in conversion

  • The ac:link with ri:user and the ADF mention node are equivalent. The account id is kept both ways and the ADF text holds the display name.
  • A ri:userkey value is not kept. The ADF save writes ri:account-id with the old key after the prefix userkey-, and the display name is Unlicensed user.
  • In the profile macro the user stays as a ri:user parameter and the macro returns unchanged.

Pitfalls

  • A mention has no link text in storage. The name shown comes from the account at view time, so it cannot be fixed in the markup.
  • A userkey from older content resolved to the name Unlicensed user in the ADF form, so convert old content to account ids before relying on mentions.
  • The rendered view of a mention and of the profile macro was not captured, because the probe output replaces macros that list people.

Sources

  1. Confluence storage format (Atlassian Documentation)
  2. Atlassian Document Format: document structure (Atlassian Developer)
  3. Insert the user profile macro (Atlassian Support)

Markdown version · All storage format pages