Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Formatting code block inside table cell in MD

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?

1 answer

0 votes

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.

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

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.

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 }`|

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.

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Bitbucket

New improvements to user management in Bitbucket Cloud 👥

Hey Community! We’re willing to wager that quite a few of you not only use Bitbucket, but administer it too. Our team is excited to share that we’ll be releasing improvements throughout this month of...

3,925 views 10 16
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you