Forums

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

How to add formatted code inside table cell?

dpe-ezrarice
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!
December 15, 2020

I'm trying to add a formatted json object as a code block inside a table cell and BitBucket just won't render the markdown correctly, but my VSCode render looks just fine. What is the proper syntax for BitBucket?

 

My markdown looks like this:

| Message ID | Description | Format |

|:---:|:--- |:--- |

**4** | Regular data transmission | <pre lang=json>{<br>  "message_id": 4, <br>  "cellular_imei": 123456789012345,<br>  "iridium_imei": 123456789012345,<br>  "device_logged_time": "2020-05-13 06:36:05"<br>  "payload": {<br>    "conductor_current_avg": "",<br>    "conductor_current_rms": "",<br>    "rssi_level": "",<br>    "board_temperature": "",<br>    "x_tilt": "",<br>    "y_tilt": "",<br>    "storage_capacitor_voltage": "",<br>    "rangefinder_height": "",<br>    "conductor_temperature": "",<br>    "ground_temperature": ""<br>  }<br>}</pre> |

 

Should render as

formatted_markdown.PNG

But is instead rendered as plaintext.

1 answer

0 votes
Soumyadeep Mandal
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
December 20, 2020
dpe-ezrarice
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!
December 20, 2020

@Soumyadeep MandalThanks for the reply. Unfortunately the first link you shared does not have an answer. It appears to be the same issue, but without a clear answer or indication that BitBucket will ever support HTML elements inside code blocks. The second link is a generic documentation of how to use different markdown styles, but again does not answer my question.

The issue here is that BitBucket claims to support the CommonMark Spec found at https://spec.commonmark.org/0.29/ but they haven't updated their documentation on how to implement escaping HTML elements. Their documentation references using "safe_mode" which was deprecated years ago when they were supporting python 2.x.

The reason I have to use HTML elements inside the code block is to "prettify" the json object for readability. I could alternatively write the entire thing as a single line code block, but that would lose a lot of value in clean documentation.

My markdown renders perfectly in GitHub but fails in BitBucket. At this rate I will be moving all of my versioned code to GitHub and paying for their service instead of supporting BitBucket.

I'd love to be proven wrong on why this doesn't render as it should, but as it stands, BitBucket has failed to deliver.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events