Home/Jira formatting reference
Jira text formatting
Text alignment and indentation in Jira: ADF alignment mark
Alignment and indentation exist only in ADF. A heading or paragraph node can carry an alignment mark (such as center) or an indentation mark with a level. Wiki markup has no syntax for either, and spaces at the start of a line do not indent text. Both marks are kept in storage but never reach the wiki read-back or the rendered html.
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": [{"attrs": {"level": 2}, "content": [{"text": "Centered", "type": "text"}], "marks": [{"attrs": {"align": "center"}, "type": "alignment"}], "type": "heading"}], "type": "doc", "version": 1}:
{
"type": "doc",
"version": 1,
"content": [
{
"type": "heading",
"attrs": {
"level": 2
},
"content": [
{
"type": "text",
"text": "Centered"
}
],
"marks": [
{
"type": "alignment",
"attrs": {
"align": "center"
}
}
]
}
]
}
Examples
ADF (API v3)
{"content": [{"attrs": {"level": 2}, "content": [{"text": "Centered", "type": "text"}], "marks": [{"attrs": {"align": "center"}, "type": "alignment"}], "type": "heading"}], "type": "doc", "version": 1}A centered heading written as ADF. v3 stores the alignment mark, v2 returns a plain h2. heading.
Rendered by Jira (HTML)
<h2><a name="Centered"></a>Centered</h2>Back to wiki after the round trip
h2. CenteredSent to Jira Cloud on .
ADF (API v3)
{"content": [{"content": [{"text": "Indented", "type": "text"}], "marks": [{"attrs": {"level": 1}, "type": "indentation"}], "type": "paragraph"}], "type": "doc", "version": 1}A paragraph with an indentation mark of level 1. The mark is stored, and the wiki and html show no indent.
Rendered by Jira (HTML)
<p>Indented</p>Back to wiki after the round trip
IndentedSent to Jira Cloud on .
Wiki markup (API v2)
h2. Indented headingSpaces before the line do not indent anything in wiki markup. They are ignored.
Rendered by Jira (HTML)
<h2><a name="Indentedheading"></a>Indented heading</h2>Back to wiki after the round trip
h2. Indented headingSent to Jira Cloud on .
Wiki markup (API v2)
* indented starThe same for a list marker. The leading spaces are dropped and the list starts at the first level.
Rendered by Jira (HTML)
<ul>
<li>indented star</li>
</ul>
Back to wiki after the round trip
* indented starSent to Jira Cloud on .
Wiki markup (API v2)
four space indent codeFour leading spaces do not make a code block or an indent. The text is a normal paragraph, and the spaces are gone in the stored ADF.
Rendered by Jira (HTML)
<p> four space indent code</p>Back to wiki after the round trip
four space indent codeSent to Jira Cloud on .
What changes in conversion
- The alignment and indentation marks are stored by v3 exactly as sent.
- v2 returns the text without them: h2. Centered and Indented. The rendered html carries no alignment or indent either.
- A field read through v2 and written back through v2 no longer contains the centering or the indentation.
- Leading spaces in wiki markup are removed in the stored ADF and are not turned into an indent.
Pitfalls
- Do not use leading spaces to indent in wiki markup. Use a list, a {quote} or a table when you need a visual offset.
- Only a heading with an alignment mark and a paragraph with an indentation mark were tested. Other node types may behave differently.
- An integration that reads a field through v2 and writes it back through v2 no longer has either mark in its text.