Is it possible to use the AtlassianWikiRenderer from releasenotes-html.vm?

Like it says :-) We're currently using a customised release-notes script which picks up the 'Description' field from our issues and writes it into the notes. Unfortunately, this doesn't parse the wiki-syntax... :-)

Is there any way to get releasenotes-html.vm to call the AtlassianWikiRenderer on this field prior to passing it to $textUtils.htmlEncode()?

3 answers

I'm interested in an answer to your question as well.

I just had a similar problem. For some reason you cant get AtlassianWikiRenderer directly with ComponentAccessor, but this code works(with Jira 5.1.8):

EventPublisher eventPublisher = ComponentAccessor.getOSGiComponentInstanceOfType(EventPublisher.class);
        VelocityRequestContextFactory velocityRequestContextFactory = ComponentAccessor.getOSGiComponentInstanceOfType(VelocityRequestContextFactory.class);
        AtlassianWikiRenderer wikiRenderer = new AtlassianWikiRenderer(eventPublisher, velocityRequestContextFactory);

        String wikiString = "*bold*";
        String htmlString = wikiRenderer.render(wikiString, null); // "<p><b>bold</b></p>"

Hi conro,

Thanks for your input. I'm not that formiliar with adapting JIRA.
How can I implement this solution so I'm able to render a wiki string in the releasenotes template?

It possible to do this also using public-api:

FieldLayoutItem fieldLayoutItem = ComponentAccessor.getFieldLayoutManager()
.getFieldLayout().getFieldLayoutItem(IssueFieldConstants.COMMENT); // CommentSystemField
JiraRendererPlugin rendererForField = ComponentAccessor.getRendererManager().getRendererForField(fieldLayoutItem);
return rendererForField.render("*test*", new IssueRenderContext(null)); // or issue.getIssueRenderContext()

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted Sep 18, 2018 in Jira

What modern development practices are at the heart of how your team delivers software?

Hey Community mates! Claire here from the Software Product Marketing team. We all know software development changes rapidly, and it's often tough to keep up. But from our research, we've found the h...

21,495 views 2 7
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you