Convert wiki markup to HTML or plain text in Jira automation
When referencing a field to send an email or notification, it can produce undesirable content, namely wiki markup. For example, {{issue.description}}
can produce something like:
This text is {color:red}RED{color}
This is hard to read and definitely not pretty. Automation for Jira Server offers ways render this as HTML or plain text.
Rendering HTML
In order to render HTML you can simple add ".html" to the end of the field. {{issue.description.html}}
produces:
<p>This text is <font color="red">RED</font></p>
This will render the description as HTML.
This may still not be appear as expected
When Jira sends HTML emails, it also incorporates all the styling into the email so therefore the HTML will look as it does in Jira.
Unfortunately, we don't have access to these styles so we just produce raw HTML with no styles.
Rendering plain text
You can also extract all the text from the HTML/wiki markup. This is usually the best way to send a clean email/notification.
This can be done by adding ".text" to the field. {{issue.description.text}}
produces:
This text is RED
Supported fields
We currently support:
- Description
- Environment
- Text Area custom fields
- Comments
- Worklogs
Stripping unwanted wiki markup from issues created via email
An unintended benefit of this feature is the ability to clean up the description of issues created via HTML emails. These descriptions can contain a lot of font and color tags. To remove these simply edit the issue and set the description to:
{{issue.description.text}}}