Just a heads up: On March 24, 2025, starting at 4:30pm CDT / 19:30 UTC, the site will be undergoing scheduled maintenance for a few hours. During this time, the site might be unavailable for a short while. Thanks for your patience.

×
Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

How to render html in custom web-panel in jira?

Egor Erofeev July 12, 2018 edited

Hello,

I can render html in CustomField, setting the wikirender for it. 

How can we display html (rendered) in custom web-panel using velocity template from Java variable?

What I've tried so far:

https://community.atlassian.com/t5/Answers-Developer-Questions/How-to-add-rich-text-editor-wiki-markup-in-velocity/qaq-p/496215

https://community.atlassian.com/t5/Answers-Developer-Questions/How-do-you-enable-render-options-for-a-JIRA-custom-field-type/qaq-p/529553

https://community.atlassian.com/t5/Jira-questions/How-to-render-wiki-markup-in-velocity-for-JIRA/qaq-p/44097

My velocity.vm: (i want "html" variable to be rendered using wiki-markup)

#disable_html_escaping()

#set($componentManagerClass=$constantsManager.getClass().getClassLoader().findClass('com.atlassian.jira.ComponentManager')) #set ($method = $componentManagerClass.getDeclaredMethod('getInstance', null))
#set ($componentManager = $method.invoke(null, null))
#set ($rendererManager = $componentManager.getRendererManager() )
#set ($renderer = $rendererManager.getRendererForType("atlassian-wiki-render"))
#set ($ircontext = $issue.getIssueRenderContext())
#set ($renderedText = $renderer.render($html, $ircontext) )

<span style="font-weight: bold; color: green;">$renderedText</span>

Any help will be appreciated, 

Regards.

0 answers

Suggest an answer

Log in or Sign up to answer
TAGS
atlassian, atlassian government cloud, fedramp, webinar, register for webinar, atlassian cloud webinar, fedramp moderate offering, work faster with cloud

Unlocking the future with Atlassian Government Cloud ☁️

Atlassian Government Cloud has achieved FedRAMP Authorization at the Moderate level! Join our webinar to learn how you can accelerate mission success and move work forward faster in cloud, all while ensuring your critical data is secure.

Register Now
AUG Leaders

Upcoming Jira Events