Hi @Nir Haimov
Can you please help me that how to convert from HTML into JIRA format using C# or javascript?
Hi @Kapil Soni
I'm not really familiar with a way to achieve this.
Try the answer on this post:
https://community.atlassian.com/t5/Jira-questions/Jira-Text-Formatting-to-HTML-JavaScript-Parser/qaq-p/607235
I am REALLY confused how Jira has not provided a simple SDK or tool to convert HTML into the Jira Markup for use with the REST API. Does everyone have to painfully map HTML tags to markup blocks?
yeah i agree this is ridiculous
@Michael Cowan @Kapil Soni I am also facing the same issue.
there is one npm module is present though its not converting it properly but you can give it a try
can you please try to create and publish for .Net Core so that would be great as of now .Net core is more usable than standard one and thank you so much for looking into this.
I will try to to create something, but can't promise anything, i might be able to create a solution only for part of the conversion from HTML to Jira and not all of it.
I will do my best and keep you update
Thank you so much for quick prompt and its enough for all of us to convert HTML to Jira. Meanwhile day after will post my solution here which covers around 95% HTML to Jira convert using javascript/jQuery.
Hi @Kapil Soni @faisalamdani @Michael Cowan @Noah Povis
I create a nuget package:https://www.nuget.org/packages/Html2JiraMarkup/
you are welcome to download and use it.
No need to mention i tested it and it works for me, but i didn't tested all use cases, so let me know if something not converting well
Once you confirm it works fine, i will post an article so anyone who will search for the same solution will find it easily.
Hi, this does not work for me:
original string :
<p>Le prix total d'un computer ne peux jamais dépasser 1000 $<br />Le contrôle est effectué sur la page caddie.</p>
after using Jira markup Html2JiraMarkup, here is the converted string :
\ \Le prix total d'un computer ne peux jamais dépasser 1000 $<br />\Le contrôle est effectué sur la page caddie.\
REST Error 400After doing this :
private static string CleanStringDescription(string str){string s = HttpUtility.HtmlDecode(str);string cleanStr;cleanStr = Regex.Replace(s, @\n, "");cleanStr = Regex.Replace(cleanStr, @\r, "");cleanStr = Regex.Replace(cleanStr, @\t, "");cleanStr = Regex.Replace(cleanStr, @<p>, "");cleanStr = Regex.Replace(cleanStr, @</p>, "");cleanStr = Regex.Replace(cleanStr, @<br />, "");
return cleanStr;}
It works !
Le prix total d'un computer ne peux jamais dépasser 1000 $Le contrôle est effectué sur la page caddie.
I hope this help.
Hi @Patrick Le Garrec
except for the <br /> that i will fix, there is nothing to do with Html2JiraMarkup to "REST Error 400"
If the API fails for you that because something you are not doing right.
In worst case, Html2JiraMarkup will convert partial of the HTML string but the still the string will be post to Jira, even if you just send HTML as is to Jira, it will post it, and you will see all the HTML tags in your Jira field, so in any case this should not fail in API, unless you are doing something wrong, and it's not related to the conversion of the HTML string
Yes, you are right.i edit the post to share the way i fixed the issue.
I updated the Html2JiraMarkup package, so now your <br /> will be changed
You are all welcome to follow up this article on this subject
https://community.atlassian.com/t5/Jira-articles/Convert-HTML-to-Jira-WikiMarkup/ba-p/1781055#M5257
Hello @Nir Haimov
I am using the html-2-jira-markup nuget package manager. But facing the problem with ul, ol tag. Can you please suggest is there way to resolve this.
Hi @Milind Suresh Nikam
Please share the HTML string you are trying to convert and the output converted string you get
Html String
<b>From</b>: Test \\\\<b>To</b>: Test \\\\<b>Subject</b>: Test for Bullet points \\\\<b>Email Body</b>: <p>Hello,</p><p> </p><p>This is a<strong> test email.</strong></p><ul><li>test</li><li>test</li></ul><p><strong>checking below:</strong></p><ol><li>test</li><li>test</li></ol><p>Thank you,</p><p> </p><p><strong>Test </strong><i>Test<strong> </strong>Test</i></p><p>Test</p>
@Milind Suresh Nikam and what string you get when you try to convert this?
Also, why you have multiple \\\\ in your HTML string?
It looks like you're new here. Sign in or register to get started.