Code blocks nested inside of lists do not work
I'm unable to nest a multi-line code block inside of a list. The code all appears on one line. Example:
-
Item One
Code line 1 Code line 2
-
Item Two
Comments (12)
-
-
I struggled with this as well earlier this month. What I found was that you have to use indented code blocks, not blocks delineated by ticks marks. So in order to get a multi-line code block nested within a list, such as:
GET
Retrieve the user's account info
-
Request
- Headers
Accept: application/json X-LTC-User-ID: {stored user ID} X-LTC-API-Key: {stored user API key}
- Headers
-
Response 200 (application/json)
-
Headers
Content-Type: application/json
-
Body
-
You'll have to put 8 spaces in front of the code block, in addition to the indentation for whatever list level you want it to work on, like so (spaces represented by periods here):
#### GET Retrieve the user's account info + Request ....+ Headers \n ............Accept: application/json ............X-LTC-User-ID: {stored user ID} ............X-LTC-API-Key: {stored user API key} \n + Response 200 (application/json) ....+ Headers \n ............Content-Type: application/json \n ....+ Body
I also found that you have to have the newlines before & after the indented code block, otherwise it will end up as a regular paragraph under that list level. The biggest problem that I've found with this implementation is that you cannot use the spiffy syntax highlighting with indented code blocks, but otherwise they do work.
-
-
There is now old BitBucket bug report, please vote there
https://bitbucket.org/site/master/issues/6778/fenced-code-blocks-inside-list-bb-7955
-
Need fenced code block to work as part of list item.
-
In latest as of today cloud version of bitbucket (6.2) the problem still exists however I can use triple backticks as long as I leave an empty line before and after the code block.
-
Same problem, Bitbucket’s markdown is basically broken
-
I too am having this problem.
-
Having the same issues. My readme page is not looking very pleasant.
-
Bitbucket your markdown rendering is broken. Would you kindly fix it?
I cannot get code blocks that are part of a list element to indent and format properly, although it looks fine in Intellij and renders correctly at [https://dillinger.io/](https://dillinger.io/)
e.g I need the code block indented under “b”:
-
a
- b
{"a": "b"}
This works properly in Intellij and dillinger.io. Why can’t it work properly on bitbucket?
-
-
@Mateusz Łoskot
Thanks for your post. I was wondering why this was not working.
I have voted. -
Thanks for posting this. I went to https://bitbucket.org/site/master/issues/6778/fenced-code-blocks-inside-list-bb-7955 and voted for the bug to be fixed.
-
Account Deactivated Upvote +1
- Log in to comment
I have the same issue than @Benjamin Nugent, even the bitbucket example is not well displayed:
https://bitbucket.org/tutorials/markdowndemo
I've tested my markdown in some other online editors and it works properly.