Home/Jira formatting reference
Jira text formatting
Text highlight in Jira: backgroundColor in ADF, not wiki
The new Jira editor can highlight text with a background color. ADF stores it as the backgroundColor mark, but wiki markup has no notation for it, so REST API v2 returns plain text. The wiki help describes background colors only for panels.
Wiki markup
There is no wiki markup for this element.
Stored as ADF (REST API v3)
The ADF document Jira Cloud stores for ADF:{"content": [{"content": [{"marks": [{"attrs": {"color": "#fedec8"}, "type": "backgroundColor"}], "text": "highlight", "type": "text"}], "type": "paragraph"}], "type": "doc", "version": 1}:
{
"type": "doc",
"version": 1,
"content": [
{
"type": "paragraph",
"content": [
{
"type": "text",
"text": "highlight",
"marks": [
{
"type": "backgroundColor",
"attrs": {
"color": "#fedec8"
}
}
]
}
]
}
]
}
Examples
ADF (API v3)
{"content": [{"content": [{"marks": [{"attrs": {"color": "#fedec8"}, "type": "backgroundColor"}], "text": "highlight", "type": "text"}], "type": "paragraph"}], "type": "doc", "version": 1}Highlighted text sent as ADF through v3. The v2 render and the wiki read back show plain text.
Rendered by Jira (HTML)
<p>highlight</p>Back to wiki after the round trip
highlightSent to Jira Cloud on .
ADF (API v3)
{"content": [{"content": [{"marks": [{"attrs": {"color": "#ff5630"}, "type": "textColor"}], "text": "red", "type": "text"}], "type": "paragraph"}], "type": "doc", "version": 1}Text color for comparison: that mark has a wiki form, so the color survives when read back through v2.
Rendered by Jira (HTML)
<p><font color="#ff5630">red</font></p>Back to wiki after the round trip
{color:#ff5630}red{color}Sent to Jira Cloud on .
Wiki markup (API v2)
{panel:bgColor=#ff0000}
Custom red panel
{panel}The wiki way to get a colored background: a panel. Jira does not keep an arbitrary color.
Rendered by Jira (HTML)
<div class="panel" style="background-color: #ff0000;border-width: 1px;"><div class="panelContent" style="background-color: #ff0000;">
<p>Custom red panel</p>
</div></div>Back to wiki after the round trip
{panel:bgColor=#ffebe6}
Custom red panel
{panel}Sent to Jira Cloud on .
Wiki markup (API v2)
{panel:bgColor=#deebff}
Blue panel
{panel}A panel color that matches one of the built-in panel colors is kept.
Rendered by Jira (HTML)
<div class="panel" style="background-color: #deebff;border-width: 1px;"><div class="panelContent" style="background-color: #deebff;">
<p>Blue panel</p>
</div></div>Back to wiki after the round trip
{panel:bgColor=#deebff}
Blue panel
{panel}Sent to Jira Cloud on .
What changes in conversion
- The backgroundColor mark is accepted by v3 and stored, but v2 renders and returns the text without any color: the highlight is silently lost in wiki.
- A panel background is a different feature.
bgColor=#ff0000was stored as an error panel and written back as#ffebe6, while#deebffwas kept. - Per the ADF documentation, backgroundColor cannot combine with the code mark.
Pitfalls
- Do not look for a wiki notation for highlights. The color macro changes the text color only.
- Panel colors snap to the built-in panel types, so they are not a free way to highlight a phrase.
- Anything that reads the text through v2 sees it without the highlight and gets no error.
Related
- {color} text color
- {panel} macro
- {info}, {note}, {tip}, {warning}
- Combining and nesting text effects
- REST API v2 wiki markup vs v3 ADF