I will be importing data from an existing ALM tool into Jira and the Description in the ALM tool is stored in HTML. Since I cannot send the HTML via the Jira REST API I want to know if there is a way to Send the REST API HTML or Ask the REST API to convert HTML to the wiki markdown format supported by Jira.
I know you can get the HTML from Jira again as a rendered field, but my need is to move data into Jira but try to keep as much of the formatting as possible.
Hello,
You can have a look at the following thread:
https://community.atlassian.com/t5/Questions/HTML-to-Wiki-Style-Renderer-markup/qaq-p/203748
Thank you. Is there no JIRA REST API Call where the Atlassian Jira solution can take HTML and give me back the correct markdown it needs..?
Seems odd that it would not have this since it does render back HTML as a rendered field when you get items (issues).
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I am not aware of such Rest Api
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Has this issue been resolved. I am stuck in the same situation. @Alexey Matveev you said you are aware of such Rest API do you mind sharing it?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I am also curious.. I have HTML that I want to convert and post into a Jira Item .. do I have to write my own tag parser?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Michael Cowan , search for the Java package https://docs.atlassian.com/atlassian-renderer/. It will do the thing.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Anastasiya Gubina This feels like a mean joke :). I got my hopes up. That tool appears deleted? All the links are empty and don't go anywhere? Do you have another links, or am I missing something?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Michael Cowan , I believe this is just an automatically generated documentation by Maven. https://docs.atlassian.com/atlassian-renderer/8.0/project-info.html
This is how our developers included the dependency in the pom.xml file:
<dependency> <groupId>com.atlassian.renderer</groupId> <artifactId>atlassian-renderer</artifactId> <version>8.0.5</version> </dependency>
There are not so much information about this lib which is bad. However, it does convert HTML to ADF.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thank you for the follow up .. I will check it out!
Just checking .. is that the same as this?
https://www.codota.com/code/java/classes/com.atlassian.renderer.RenderContext
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.
@Anastasiya Gubina Which class in the atlassian-renderer library are you using to convert HTML to ADF?
Is it possible to share a sample snippet please?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Satheesh JM , unfortunately, I cannot share a code snippet because of NDA. As far I understand you can use com.atlassian.renderer.wysiwyg.converter.DefaultWysiwygConverter class from the atlassian-renderer library and call convertXHtmlToWikiMarkup method on the object of that class.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Anastasiya Gubina oh I did try out that class..
but it converts to only jiraMarkup right?
You had mentioned "However, it does convert HTML to ADF", so I thought there was a separate class which converts html to the ADF format (https://developer.atlassian.com/cloud/jira/platform/apis/document/structure/)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
As far as I know, there is no such method in the Jira Cloud API. That's why people in this thread discuss the usage of the additional library.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I just ended up using the V2 api to send markup instead of the document
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
lets hope we get a way to import html into the cloud before the v2 rest api gets deprecated :)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
If you're using Python, I like this tool: https://pypi.org/project/html2jirawiki/
I literally plugged it into my import script, and it converted the HTML from Wrike to Jira Wiki. Love it!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You can use text formatting notations -
Like in place of <h1></h1> You will have to send "h1. Creating of an issue using project keys and issue type names using the REST API" as description.
Hope this helps !
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Ok This is what I ended up doing for my use case..
I used the atlassian renderer library
<dependency> <groupId>com.atlassian.renderer</groupId> <artifactId>atlassian-renderer</artifactId> <version>8.0.32</version> </dependency>
First I converted html to Markup first using
new DefaultWysiwygConverter().convertXHtmlToWikiMarkup(html);
Then instead of using the v3 jira API, I used the v2 API as the v2 API accepts markup
(https://developer.atlassian.com/cloud/jira/platform/rest/v2/api-group-issue-comments/#api-rest-api-2-issue-issueidorkey-comment-post)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I tried the same thing but now I have following error:
java.lang.NoClassDefFoundError: com/opensymphony/util/TextUtils
Same like here. I tried adding
com.opensymphony.xwork
but with no luck. Did you have any similar problems?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Szymon Kaczmarek
Yeah I got some similar errors, which were mainly because of dependency conflicts with other libs.
Here's my final pom.xml
<repositories>
<repository>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>central</id>
<name>Central</name>
<url>https://repo1.maven.org/maven2/</url>
</repository>
<!--atlassian-renderer:8.0.32 is not part of the central repo. to work around that, all these other repos are needed -->
<repository>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>jcenter</id>
<name>bintray</name>
<url>https://jcenter.bintray.com</url>
</repository>
<repository>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>atlassian-3rdparty</id>
<name>Atlassian 3rd-P Old Repository</name>
<url>https://maven.atlassian.com/3rdparty/</url>
</repository>
<repository>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>mulesoft</id>
<name>Mulesoft</name>
<url>https://repository.mulesoft.org/nexus/content/repositories/public/</url>
</repository>
</repositories>
<dependencies>
.
.
.
<dependency>
<groupId>com.atlassian.renderer</groupId>
<artifactId>atlassian-renderer</artifactId>
<version>8.0.32</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17-atlassian-3</version>
</dependency>
.
.
.
</dependencies>
for me the dependency conflict was in log4j library so I explicitly added it.
you will need to figure out all the conflicting dependencies...
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
It works! Thank you!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
The steps I used:
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.