Good day!
I am trying to search if there is any possibility to convert the wiki text that JIRA gives us in a comment to HTML.
I mean:
Using scriptRunner, I can check the text that a comment gives us. This text give us a format similar to that:
as*dasdasd* {color:#ff5630} asda{color} {noformat}asdasd{noformat} {color:#ff5630}asdadsasd{color}
What I want to get its the HTML format , not the wiki format.
In server, the method used to do that is similar to that:
String renderWikiMarkup(Map issue, String data) { RendererManager rendererManager = ComponentAccessor.rendererManager JiraRendererPlugin renderer = rendererManager.getRendererForType("atlassian-wiki-renderer"); String output = renderer.render(data, issue.getIssueRenderContext()); return output }
Is there any similar or any endpoint to do that in jira cloud?
Thanks!
Hello @Alberto Barón ,
The wiki markup formatting is no longer used in Jira cloud and has been replaced by a markdown functionality, and additional details about the change can be seen In the following link noting the details in the Atlassian Status Update:
The second theme is wiki markup generally. To be transparent, we are closing this issue as we have no plans to support wiki markup in the new editor and new issue view. We're supporting markdown across Jira, Confluence, and Bitbucket Cloud to provide a more modern and consistent editing experience. For anyone using multiple Atlassian products, we believe this will provide the best editing experience. You can read more about the changes here.
So noting the removal of markup, I am not sure if Scriptrunner does currently have an equivalent option for markdown, but I can verify that the returned text will only be displayed in text fields as markdown rendered content and cannot display as plain text.
However, if you are looking to pull data from the API for use in an external application or resource the equivalent API call would be:
curl -D- -u {user}:{api_token} -X GET -H "Content-Type: application/json" https://{base_URL}.atlassian.net/rest/api/3/issue/{issueId}/comment/{commentId}?expand=renderedBody
and the renderBody will come back in the HTML encoded text, as an example, a comment on an issue that has the following:
Returns the following in the expanded variable for the renderBody as HTML:
"renderedBody":"<p>line 1 noformatting</p>\n\n<ul>\n\t<li>Bullet 1</li>\n\t<li>bullet 2</li>\n</ul>\n\n\n<ol>\n\t<li>number indent 1</li>\n\t<li>number indent 2</li>\n</ol>\n\n\n<p><b>bold</b></p>\n\n<p><em>italic</em></p>\n\n<p><del>strikethrough</del></p>\n\n<p><font color=\"#ff5630\">RED Text</font></p>\n\n<div class=\"preformatted panel\" style=\"border-width: 1px;\"><div class=\"preformattedContent panelContent\">\n<pre>CODE BLOCK</pre>\n</div></div>\n\n<div class=\"panel\" style=\"background-color: #deebff;border-width: 1px;\"><div class=\"panelContent\" style=\"background-color: #deebff;\">\n<p>Info panel</p>\n</div></div>"
Hope this helps
Regards,
Earl
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.