You're on your way to the next level! Join the Kudos program to earn points and save your progress.
Level 1: Seed
25 / 150 points
Next: Root
1 badge earned
Challenges come and go, but your rewards stay with you. Do more to earn more!
What goes around comes around! Share the love by gifting kudos to your peers.
Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!
Join now to unlock these features and more
The Atlassian Community can help you and your team get more value out of Atlassian products and practices.
Hi,
Can you please advise how I can convert the Jira Wiki format into HTML? I am using the Jira Java Rest Client API.
I have obtained the field value as follows:
String BusinessNeedWikiFormat = jiraIssue.getFieldByName("Business Need").toString(); Sting BusinessNeedHtmlFormat = ?
Is there a method that I can use to convert this value into HTML?
Thanks,
-Angela
Community moderators have prevented the ability to post new answers.
EventPublisher eventPublisher = ComponentAccessor.getOSGiComponentInstanceOfType(EventPublisher.class); VelocityRequestContextFactory velocityRequestContextFactory = ComponentAccessor.getOSGiComponentInstanceOfType(VelocityRequestContextFactory.class); AtlassianWikiRenderer wikiRenderer = new AtlassianWikiRenderer(eventPublisher, velocityRequestContextFactory); String html = wikiRenderer.render("*I am bold*", null);
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Conrad,
Thank you very much for the information :-). I have implemented the code in my application however I am seeing the following error:
java.lang.IllegalStateException: ComponentAccessor has not been initialised.
It is failing on the following line:
EventPublisher eventPublisher = ComponentAccessor.getOSGiComponentInstanceOfType (EventPublisher.class
);
Can you please advise how to resolve?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks Conrad, it worked perfectly for me ;)
But AtlassianWikiRenderer is provided by jira-core and it is not a good way to work...
Hope Atlassian will expose a public method to get HTML from wiki content :P
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi can someone help me with AtlassianWikiRenderer cannot find this method. but i already imported import com.atlassian.jira.issue.fields.renderer.wiki.AtlassianWikiRenderer
here is my code
import java.lang.*
import javax.mail.internet.*;
import javax.mail.*
import javax.activation.*
import javax.mail.Multipart;
import com.atlassian.jira.issue.Issue;
import com.atlassian.jira.ComponentManager;
import com.atlassian.jira.issue.CustomFieldManager;
import com.atlassian.jira.issue.fields.CustomField;
import com.atlassian.jira.issue.comments.CommentManager;
import com.atlassian.jira.issue.attachment.Attachment;
import com.atlassian.jira.issue.AttachmentManager;
import com.atlassian.jira.issue.history.ChangeItemBean;
import com.atlassian.jira.util.AttachmentUtils;
import com.atlassian.jira.util.PathUtils;
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.gzipfilter.org.apache.commons.lang.StringUtils
import groovy.text.GStringTemplateEngine;
import com.atlassian.event.api.EventPublisher
import com.atlassian.jira.util.velocity.VelocityRequestContextFactory
import com.atlassian.jira.issue.fields.renderer.wiki.AtlassianWikiRenderer
import com.atlassian.jira.issue.fields.renderer.JiraRendererPlugin
import org.springframework.beans.factory.DisposableBean
EventPublisher eventPublisher = ComponentAccessor.getOSGiComponentInstanceOfType(EventPublisher.class);
VelocityRequestContextFactory velocityRequestContextFactory = ComponentAccessor.getOSGiComponentInstanceOfType(VelocityRequestContextFactory.class);
AtlassianWikiRenderer wikiRenderer = new AtlassianWikiRenderer(eventPublisher, velocityRequestContextFactory);
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Conard
How can we access the AtlassianWikiRenderer ? I am using .NET client for Rest API via webservice reference but the AtlassianWikiRenderer is not available also I have tried the Atlassian SDK library for .NET but that too does not provide the AtlassianWikiRenderer functionality.
Can you please tell me how can I utilize this functionality in .NET application?
Like Angela; My intention is to convert the wiki format text received from the api to html.
Thanks a lot
Best Regards,
Sp
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
There is an undocumented rest resource:
/rest/api/1.0/render
Body:
{"rendererType":"atlassian-wiki-renderer","unrenderedMarkup":"*test*"}
Response:
<p><b>test</b></p>
This resource is used by Jira when you click the preview button in wiki-renderer fields.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Conrad,
Is this working?
Thank you.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi again.
It's working fine.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
There is a problem with that REST service. On JIRA Cloud it doesn't work with JWT token authentication. So, there is an issue opened since 2014 and nothing was made until now.
You can see it here: https://jira.atlassian.com/browse/JRA-38731.
Thanks.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Conrand,
Does below code will extract all the Description with color / Table everything.
My challenge is not able to get the Images from Story, I am trying to convert Images from JIRA to my JAVA application.
Please help I am stuck from many days.
EventPublisher eventPublisher = ComponentAccessor.getOSGiComponentInstanceOfType(EventPublisher.class); VelocityRequestContextFactory velocityRequestContextFactory = ComponentAccessor.getOSGiComponentInstanceOfType(VelocityRequestContextFactory.class); AtlassianWikiRenderer wikiRenderer = new AtlassianWikiRenderer(eventPublisher, velocityRequestContextFactory); String html = wikiRenderer.render("*I am bold*", null);
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.