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?
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
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);
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I have used renderFields.description property to get the HTML Markup.
thanks for your suggestion.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.