Home/Jira formatting reference
Jira text formatting
Work item keys and smart links in Jira wiki and ADF
A work item key written as [KEY-1] or as plain text is rendered as a link with the issue type icon and summary. ADF stores it as an inlineCard with the browse URL. The ADF card types inlineCard, blockCard and embedCard come back through v2 as plain links.
Wiki markup
[WEB-1]
WEB-1
Stored as ADF (REST API v3)
The ADF document Jira Cloud stores for ADF:{"content": [{"content": [{"attrs": {"url": "https://example.com"}, "type": "inlineCard"}], "type": "paragraph"}], "type": "doc", "version": 1}:
{
"type": "doc",
"version": 1,
"content": [
{
"type": "paragraph",
"content": [
{
"type": "inlineCard",
"attrs": {
"url": "https://example.com"
}
}
]
}
]
}
Examples
Wiki markup (API v2)
[WEB-1]Link another work item by its key and get its icon and summary in the rendered text.
Rendered by Jira (HTML)
<p>
<span class="jira-issue-macro" data-jira-key="WEB-1" >
<a href="https://your-site.atlassian.net/browse/WEB-1" class="jira-issue-macro-key issue-link" title="Checkout redesign" >
<img class="icon" src="https://your-site.atlassian.net/rest/api/2/universal_avatar/view/type/issuetype/avatar/10307?size=medium" />
WEB-1
</a>
<span class="aui-lozenge aui-lozenge-subtle aui-lozenge-complete jira-macro-single-issue-export-pdf">To Do</span>
</span>
</p>Back to wiki after the round trip
[WEB-1]Sent to Jira Cloud on .
Wiki markup (API v2)
WEB-1 mentioned in textType the key inside a sentence with no brackets.
Rendered by Jira (HTML)
<p>
<span class="jira-issue-macro" data-jira-key="WEB-1" >
<a href="https://your-site.atlassian.net/browse/WEB-1" class="jira-issue-macro-key issue-link" title="Checkout redesign" >
<img class="icon" src="https://your-site.atlassian.net/rest/api/2/universal_avatar/view/type/issuetype/avatar/10307?size=medium" />
WEB-1
</a>
<span class="aui-lozenge aui-lozenge-subtle aui-lozenge-complete jira-macro-single-issue-export-pdf">To Do</span>
</span>
mentioned in text</p>Back to wiki after the round trip
[WEB-1] mentioned in textSent to Jira Cloud on .
Wiki markup (API v2)
{jira:WEB-1}Try the macro form of a work item link.
Rendered by Jira (HTML)
{jira:WEB-1}Back to wiki after the round trip
{jira:WEB-1}Sent to Jira Cloud on .
Wiki markup (API v2)
[smart-link|https://example.com|smart-link]Write a link with an alias and a title in wiki and see what ADF stores.
Rendered by Jira (HTML)
<p><a href="https://example.com" title="smart-link" class="external-link" rel="nofollow noreferrer">smart-link</a></p>Back to wiki after the round trip
[https://example.com|https://example.com|smart-link]Sent to Jira Cloud on .
ADF (API v3)
{"content": [{"content": [{"attrs": {"url": "https://example.com"}, "type": "inlineCard"}], "type": "paragraph"}], "type": "doc", "version": 1}Create an inline smart link card from ADF.
Rendered by Jira (HTML)
<p><a href="https://example.com" title="smart-link" class="external-link" rel="nofollow noreferrer">https://example.com</a></p>Back to wiki after the round trip
[https://example.com|https://example.com|smart-link]Sent to Jira Cloud on .
ADF (API v3)
{"content": [{"attrs": {"url": "https://example.com"}, "type": "blockCard"}], "type": "doc", "version": 1}Create a block smart link card from ADF.
Rendered by Jira (HTML)
<p><a href="https://example.com" title="smart-card" class="external-link" rel="nofollow noreferrer">https://example.com</a></p>Back to wiki after the round trip
[https://example.com|https://example.com|smart-card]Sent to Jira Cloud on .
ADF (API v3)
{"content": [{"attrs": {"layout": "center", "url": "https://example.com"}, "type": "embedCard"}], "type": "doc", "version": 1}Create an embedded card from ADF.
Rendered by Jira (HTML)
<p><a href="https://example.com" title="smart-embed" class="external-link" rel="nofollow noreferrer">https://example.com</a></p>Back to wiki after the round trip
[https://example.com|https://example.com|smart-embed]Sent to Jira Cloud on .
What changes in conversion
- A key in brackets or in plain text is stored as an inlineCard whose url is the browse address of the work item. The wiki read adds the brackets back, so
WEB-1 mentioned in textcomes back as[WEB-1] mentioned in text. - A link written as [alias|url|title] is stored as an inlineCard with only the url. The alias is lost and the wiki read repeats the url as alias.
- inlineCard, blockCard and embedCard all come back through v2 as [url|url|title] with the title smart-link, smart-card or smart-embed.
- The macro form {jira:WEB-1} is not interpreted: it is stored as text and rendered with the braces.
Pitfalls
- A key only becomes a card if the work item exists and the writer can see it. The probes used a key that exists on the site.
- The card type (inline, block, embed) is lost in a v2 read. Use v3 when the layout of the card matters.
- The alias in
[alias|url]is not kept when Jira turns the link into a smart link card.
Related
- [alias|url] external links
- [~accountid:] mentions
- [pagetitle] and [space:page] links
- REST API v2 wiki markup vs v3 ADF