Forums

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

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, jira service management, jsm webinar, ai in jsm, opsgenie integration, incident management, virtual agent, atlassian intelligence, ai-powered service desk, it operations, atlassian learning, service management webinar, team '25 recap

What’s new in Jira Service Management 🤔

Discover how Atlassian is revolutionizing service management with cutting-edge solutions for AI-powered support, HR Service Management, or DevOps connectivity.

Register here ⬇️
AUG Leaders

Atlassian Community Events