SonarQube 5.6: How to add issue comment in html text format using web service

481 views Asked by At

SonarQube has webservice api to add comment api/issues/add_comment.This webservice api takes parameter as issue_id and text. I want to add html text not the plain text. whatever text, i am passing , it consider as normal text. How to pass htmlText/markdown as comment using webserive add comment api Example :

http://localhost:9000/api/issues/add_comment?text="<a href="http://www.link.com" target="_blank">visit this issue</a>" &issue=abcd-e0a3-49dc-9d46-45bf92748361

The above api writes everything as normal text in sonar issue comment section.

1

There are 1 answers

0
Fabrice - SonarSource Team On

This is not possible to post a comment in HTML format, simply to avoid security issues like XSS.

The "text" parameter accepts SonarQube Markdown format, for which you can see the online documentation at https://sonarqube.com/markdown/help