MarkupTransformer converts img tags to ADF

Hi, I think this is a bug in MarkupTransformer:

Using the code in this example to convert from HTML into Wiki Markup, img tags get incorrectly converted into ADF format:

For example, given HTML:

<p><img src="http://jira:8080/secure/attachment/10200/123.png" alt="">test</p>

For instance, in this case it is converting to ADF format and not wiki like it should:

{adf:display=inline}{"type":"image", "attrs":{"src":"https...", "alt"="test"}}{adf}

This is an issue since in Jira only wiki markup is expected, not ADF. The above gets posted in plain text.

I think the correct wiki markup is something like this?:

[!](....path to image)

This is using:

@atlaskit/editor-wikimarkup-transformer 11.0.9

P.S. one really strange behavior is that though this adf format does not display correctly as an image inside of a Jira comment, when converting back from wiki into HTML it does get correctly converted back into an img tag.

even more interesting is I found a workaround but unfortunately wiki images (formatted like: !..!) get converted back from wiki into HTML like the following (again using Atlaskit transformers):

<div data-node-type="mediaSingle" data-layout="center" data-width=""><div data-id="" data-node-type="media" data-type="external" data-collection="" data-width="200" data-height="183" data-url="http://localhost:8080/secure/attachment/10300/128x1282x.png" data-alt="" title="Attachment" style="display: inline-block; border-radius: 3px; background: #EBECF0; box-shadow: 0 1px 1px rgba(9, 30, 66, 0.2), 0 0 1px 0 rgba(9, 30, 66, 0.24);"></div></div>

The workaround is I am regex replacing {adf} statements to get them into the !..! format. Not perfect but works. Now even if the first question is solved I’m unsure how to get this to display as an image as-is?

1 Like