Markdown in Code Insights Report

I have started playing around with recently introduced code insights Introducing Code Insights for Bitbucket Server, continuously improve code quality with quick actionable feedback from apps

Documentation and tutorials on this topic seem well structures but I could not find anything on report markdown. I was wondering if insights support markdown like comments do? I specifically need things like :red_circle: and :white_check_mark: I tried providing these in my API call but it seem that insights report does not support them.

Hi @mihajlovic.uros.96,

It’s great that you’re looking into the code insights feature.
Code insight reports do not support markdown text. Reports support:

  • a plain text description
  • up to 6 fields for displaying data (this doesn’t accept markdown either, but it displays a selection of data types in a user friendly way. Supported types are boolean, date, duration, link, number, percentage, and text)
  • result (pass/fail)

You can also use annotations on individual lines, and use the severity field to emphasis certain annotations.

Before I open a suggestion issue on our Jira instance may I ask for some more detail as to why you want to display markup? Also, does your use case require the use of markdown in the ‘data’ fields or just in the description?

Looking forward to hearing your feedback,
Kristy Hughes
Developer on Bitbucket Server

Hi @khughes

I just wish to make the description more stylistic. I have a Jenkins Pipeline which performs various builds of my code. So far I would display the results of these builds as a comment on the PR. Comments allowed me to use markdown to display nicely readable table with some special characters to indicate a pass and fail builds. Since this is becoming overcrowded I thought I can move this to insights report. I would like to preserve the format of the table (which uses comment markdown) in the insights report. Only description (i.e. details parameter) markdown would be sufficient.

Regards
Uros

I’ve opened BSERV-11523 to track adding markdown to code insight reports. You can vote and comment on the issue to explain more about the use case, however this will have to go through the normal triage and road-mapping process, so I cannot guarantee when or if this will be implemented.

Depending on what you would want to show in your table there are a few options you can consider now:

  1. If there are files in the table, you could consider using file-level annotations (annotations with a line number of 0) to display the information for that row in the table on the file that it belongs to.
  2. If there are only a handful of rows in your table, you could create one report per row in your table. Then the data that would normally be in the other columns for that row could be displayed in the ‘data’ fields of the report. By doing this you could also use the pass/fail status of the report in lieu of using :red_circle: and :white_check_mark:.
  3. Ignoring the table problem, you can try using unicode characters, such as :white_check_mark::stop_sign: to solve the emoji problem
  4. If you’re not set on using code insights, another option is to set the build status and have a different build status for each build. This would also allow users to optionally set merge-checks to block the pull request from merging if one of those builds aren’t passing.

Hope that helps!

1 Like