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 cloud certification, managing jira projects, jira project administration, jira cloud exam, atlassian certification, agile project management, jira workflows, jira permissions, jira training, jira cloud skills, atlassian learning

Become a Certified Jira Service Project Expert 🦸🏻‍♂️

Validate your expertise in managing Jira Service Projects for Cloud. Master configuration, optimize workflows, and manage users seamlessly. Earn global 🗺️ recognition and advance your career as a trusted Jira Service management expert.

Get Certified! ✍️
AUG Leaders

Atlassian Community Events