How to Format a Reply as a Code Snippet When Responding to a Bitbucket Comment via Slack?

I am trying to reply to a comment, on a PR, on bitbucket with a code snippet instead of plain text, from the associated slack channel.

1

3 Answers

It is quite straightforward. Put the code lines in between these(). As StackOverflow is following the same thing, I have to apply some trick:

Let = AAA. Then,

AAA

This is your code. Place your code here.

AAA

This will be the output:

This is your code. Place your code here.

Have a look at the Atlassian markdown syntax guide:

In to format your comment as a code block you indent it by 4 spaces.

use 3 '`' chars to make a code block. you can also give a language syntax hint by adding the name of the language after the 3 ticks.

i.e.

javascript
var x = 0;

which looks like

var x = 0;

or you can do inline code using a single '`'.

i.e.

Your variable `VAR_NAME` is never initialized

which looks like this

Your variable VAR_NAME is never initialized

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Robert Thorne

Robert Thorne

Automotive & Future Transportation Editor

Robert Thorne covers electric vehicle innovations, autonomous driving systems, global mobility trends, and automotive engineering developments.

Share this article
Twitter Facebook Pinterest