Join 34,000+ subscribers and receive articles from our blog about software quality, testing, QA and security.

API Post comment with markdown


I’m trying to post a test result using the API that contains a comment with markdown (leading spaces)

Currently, leading whitepsaces are normalized with 1 space which circumvents the markdown. I’m trying to print failed stack trace formatted (markdown) in monospace/code for better readability. Prior to the change to JSON, this use to work.

Is this a limitation with JSON or is there a workaround?



I forgot to mention that it is possible to use the back-tick (`) or the triple back-tick (```) for code/monospaced typeface markdown, however it still removes the white spaces so the Java Stack trace is not aligned.


Hello Costa,

Thanks for your posting and my apologies for the delayed response. We will look into this shortly and I believe this could be a bug/issue with ‘trimming’ the text. I believe one workaround would be to add a separate line of text before the stack trace, e.g.:

[code]Stack trace:

Trace 1..
Trace 2..
Trace 3..




Unfortunately, I tried that and it appears to not work. I parse out each line of the stack trace, add a backtick (`), four white spaces and a new line (\n) which does allow the markdown to work, however the white spaces are removed.

Here’s my Java code:

    private String stringToMarkdown( String stackTrace )
        Scanner scanner = new Scanner( stackTrace );
        String formattedString = "";
        while ( scanner.hasNextLine() )
            formattedString = formattedString + "`    " + scanner.nextLine() + "`\n";
            System.out.println( formattedString );
        return formattedString;

The output is then posted (HttpPost) as part of the comment field.


Thanks for the additional details. We will try to reproduce this here and get back to you then.



When I post a string to the API for the comment field, I can’t get it to create a line break, and none of the rich text formatting options seem to work without a line break. (I’m also trying to post a stack trace to the comment field in a way that is usable). Thanks.


Hi Titus,

Which API binding do you use and how do you format the line break? With most programming languages, you would need to add a "\n" to separate the lines.