Going Stellar

Home/Jira formatting reference

Jira text formatting

Image width, height, alt and alignment in Jira markup

After the URL, | starts a comma separated list of name=value pairs that become attributes of the image tag. The help lists thumbnail and align=right, vspace=4 as examples. On Cloud, only a few of them survive the move to ADF.

Wiki markup

!image.jpg|thumbnail!
!image.gif|align=right, vspace=4!
!https://example.com/logo.png|width=200,height=100!
!https://example.com/logo.png|alt=Company logo!

Stored as ADF (REST API v3)

The ADF document Jira Cloud stores for ADF:{"content": [{"attrs": {"layout": "center"}, "content": [{"attrs": {"height": 100, "type": "external", "url": "https://example.com/logo.png", "width": 200}, "type": "media"}], "type": "mediaSingle"}], "type": "doc", "version": 1}:

{
 "type": "doc",
 "version": 1,
 "content": [
  {
   "type": "mediaSingle",
   "attrs": {
    "layout": "center"
   },
   "content": [
    {
     "type": "media",
     "attrs": {
      "type": "external",
      "url": "https://example.com/logo.png",
      "height": 100,
      "width": 200
     }
    }
   ]
  }
 ]
}

Examples

Wiki markup (API v2)

!https://example.com/logo.png|width=200!

Fix the displayed width only. The HTML gets a width attribute and no height.

Rendered by Jira (HTML)

<p><span class="image-wrap" style=""><img src="https://example.com/logo.png" width="200" style="border: 0px solid black" /></span></p>

Back to wiki after the round trip

!https://example.com/logo.png|width=200,height=183!

Sent to Jira Cloud on .

Wiki markup (API v2)

!https://example.com/logo.png|width=200,height=100!

Fix both sizes so the layout does not jump while the image loads. Both values are stored in ADF and come back unchanged.

Rendered by Jira (HTML)

<p><span class="image-wrap" style=""><img src="https://example.com/logo.png" height="100" width="200" style="border: 0px solid black" /></span></p>

Back to wiki after the round trip

!https://example.com/logo.png|width=200,height=100!

Sent to Jira Cloud on .

Wiki markup (API v2)

!https://example.com/logo.png|alt=Company logo!

Add alt text for screen readers. ADF keeps it as the alt attribute, and wiki written from ADF puts the value in quotes.

Rendered by Jira (HTML)

<p><span class="image-wrap" style=""><img src="https://example.com/logo.png" alt="Company logo" style="border: 0px solid black" /></span></p>

Back to wiki after the round trip

!https://example.com/logo.png|width=200,height=183,alt="Company logo"!

Sent to Jira Cloud on .

ADF (API v3)

{"content": [{"attrs": {"layout": "center"}, "content": [{"attrs": {"height": 100, "type": "external", "url": "https://example.com/logo.png", "width": 200}, "type": "media"}], "type": "mediaSingle"}], "type": "doc", "version": 1}

The same 200 by 100 image written as ADF. v2 returns the wiki form with width and height.

Rendered by Jira (HTML)

<p><span class="image-wrap" style=""><img src="https://example.com/logo.png" height="100" width="200" style="border: 0px solid black" /></span></p>

Back to wiki after the round trip

!https://example.com/logo.png|width=200,height=100!

Sent to Jira Cloud on .

What changes in conversion

  • width, height and alt are kept in ADF as media attributes. With only width=200, ADF still gets height 183, and the wiki read back from it gains height=183.
  • alt=Company logo comes back from ADF as alt="Company logo", with quotes.
  • align=right, vspace=4 and thumbnail were not stored as such: the media node had layout center and width 200, height 183. These two probes used file names with no attachment, so a write-back could not be tested.
  • In ADF the placement is the layout attribute of mediaSingle (per the documentation: wrap-left, center, wrap-right, wide, full-width, align-start, align-end). The wiki align attribute has no mapping in these runs.

Pitfalls

  • Do not rely on align, vspace or thumbnail in a field that Cloud stores as ADF; the stored node used layout center.
  • The pairs are separated by commas. Spaces after the comma were accepted in the help example, but the safest form is width=200,height=100.
  • Setting only one dimension still ends with both stored in ADF, so the picture may be stretched if 183 is not the right height.

Sources

  1. Text Formatting Notation Help (Jira, in-product help)
  2. Atlassian Document Format: document structure (Jira Cloud platform)

Markdown version · All formatting pages