Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Formatting code block inside table cell in MD

Dmitry Korotkov October 1, 2018

Hi!

In out team we try to use BitBucket to store test cases in Markdown format. The main goal is to maintain test cases as a code, including pull requests, automatic QG etc.

Our usual test case looks like a table:

| #    | Description   | Expected result                                       |
| ---- | ------------- | ------------------------------------------------------|
| 1 | Call some API | Answer ```json-object {"responce" : "Hello world!"}```|

 Unfortunately  BitBucket doesn't format code block inside table cell. Splitting it to several lines manually using <br> also doesn't work.  In one line it looks unreadable. Is there any workaround?

2 answers

0 votes
Kiran Muddaiah
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
June 3, 2025

In your table, you can use  `<br>` to create line breaks within a table cell.
This is an **HTML line break tag** and is commonly used in Markdown tables to:

 

| # | Description | Expected result |
|----|---------------|------------------------------------------------------------------------------------------|
| 1 | Call some API | <br>{<br> "response": "Hello world!",<br> "status": 200,<br> "iamlong": true<br>}<br> |

0 votes
VICTOR-OSEGHALE
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
October 2, 2018

Hi Dmitry,

Thanks for reaching out here.

I have used the table you provided in the comment as a sample table, and added some new rows with a few formats as shown in the image attached.

source.png

Looking at the rendered view, it properly formats the the code blocks within the cells as expected;

rendered.png

For my case, I have used Bitbucket Server 5.14.0 for this. What version of Bitbucket Server instance are you using to test this out ?

Kind Regards,
Victor.

Dmitry Korotkov October 2, 2018

Victor, thank you for your answer.

I think it was my fault to provide a bad example, let me try once more :) 

2018-10-03_09-03-34.png2018-10-03_09-03-53.png

First exaple is code block with json syntax highlighting NOT in a table cell. It's OK.

Now I try to get the same result in a table cell.

Next example shows that I can't use multiline code block in table cell, ok.

In the third one I try to use br in one-liner and it doesn't work. Highlighting doesn't work aslo.

In last example is the only workaround I could find, but it looks not very beautiful and still no highlighting.

We use Atlassian Bitbucket v5.11.1

VICTOR-OSEGHALE
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
October 3, 2018

Hi Dmitry,

Thanks for the feedback.

Add the text format of this test case for me to get a better insight on this.

Kind Regards,
Victor.

Dmitry Korotkov October 3, 2018

Victor,

here it is:

```json
{
"responce" : "Hello world!",
"status": 200,
"iamlong": true
}
```

| # | Description | Expected result |
| ---- | ------------- | ------------------------------------------------------|
| 1 | Call some API | Answer ```json
{
"responce" : "Hello world!",
"status": 200,
"iamlong": true
}
```|


| # | Description | Expected result |
| ---- | ----------------------- | -----------------------------------------------------------------------------------------|
| 1 | Call <br> some <br> API | Answer ```json {"responce" : "Hello world!", <br> "status": 200, "iamlong": true } ``` |
| 2 | Call some API | Answer `{"responce" : "Hello world!", ` <br> ` "status": 200, ` <br> ` "iamlong": true }`|
Devora Hosseinof
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
April 6, 2021

Hi - I'm looking for the answer to Dmitry's question and I don't see it. Can someone help me?
I need to add a code block of multiple lines into a table cell.

Like Tonny Madsen likes this

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events