Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

How to convert JIRA's wiki markup to HTML?

Jouni
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
June 16, 2017

I used DefaultWysiwygConverter (from http://mvnrepository.com/artifact/com.atlassian.renderer/atlassian-renderer/8.0.5) to convert HTML to Wiki markup, but didn't manage to do the opposite. I tried following:

DefaultWysiwygConverter converter = new DefaultWysiwygConverter();
RenderContext context = new RenderContext();

String wikiMarkup = ...

String html = converter.convertWikiMarkupToXHtml(context, wikiMarkup);

But this failed, since apparently something called "WikiStyleRenderer" was not defined in DefaultWysiwygConverter.

Any tips on how to get Wiki markup to HTML work?

 

4 answers

6 votes
Satheesh JM
Contributor
July 20, 2021

2 ways 

#1 
you can use the /render api to convert markup to html

 curl -XPOST "/rest/api/1.0/render" -H 'Content-Type: application/json;charset=utf-8' -d '{"rendererType":"atlassian-wiki-renderer","unrenderedMarkup":"*Hello World*"}'

 


#2 

or you can use 

expand=renderedBody

for eg. if you it is an issue comment 

curl -XGET "/rest/api/3/issue/${issueId}/comment/${commentId}?expand=renderedBody"

will give you html body in the response

3 votes
Andy Brook
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 7, 2017

 

So long as you have an issue in context (usually the case in JIRA):

JiraRendererPlugin wikiRenderer = fRendererManager.getRendererForType("atlassian-wiki-renderer");
IssueRenderContext renderContext = renderContext = new IssueRenderContext(issueObject);
String html = wikiRenderer.render(wikiMarkup, renderContext);

 

 

Hakan Akdag
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
April 3, 2023

Hello @Andy Brook

I know this is an old thread but I want to know how to run the code block you shared here. 

My issue here is, I cant add jira packages in IntelliJ. Can you please help what should I do?

Thanks!

0 votes
Graham Meaden January 18, 2022

Does anyone know how to do this in Python?

0 votes
Suresh Mateti November 9, 2020

I have used renderFields.description property to get the HTML Markup.

thanks for your suggestion.

faisalamdani July 15, 2021

how you have used can you please explain?

Andrey Permyakov January 23, 2022

@faisalamdani 

Were you able to resolve this issue?

Vitor Prado January 12, 2023

With automation {{issue.description.html}} worked for me.

Like Burak Bal likes this
Willian Rezende
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
April 12, 2023

Hello,

How did you use automation to perform this conversion?

Suggest an answer

Log in or Sign up to answer