This post will show you code snippets you can use to sync over comments from Jira Cloud to Azure DevOps & keep the right format.
This will keep the format for Headings, Lists, Url's, Bold & Italic text and it will also do inline user mentions.
(Inline images will be added later).
Jira Cloud
First we need the comments to come from Jira Cloud to ADO so we start in the JC outgoing sync.
We apply changes on the comment if the coment has a user mention in it → [~accountid:<Jira user account ID>], this is done with REGEX to find the right pattern /\[~accountid:(.*?)]/ will find all the user ID's.
With the help of our nodeHelper we can find the email address linked to the userID, if we found an email we replace the email with the ID.
the comment will be synced over with the right email.
Azure DevOps
On the ADO side we need to add a new class that will convert Wiki to HTML.
This class has a constructor that needs the nodeHelper and the projectName (String).
Add this class at the top of your script.
Create a new WikiToHtml object and call the wikiToHTML method, this method expects a String.
The method will return your given String (Wiki format) and will convert it to HTML.
To apply this on your comments you can do something like this.