Bitbucket nested lists #1459
-
Hello, Looking at the Bitbucket's Markdown syntax guide where Markdown should be written "as specified in CommonMark (with a few extensions)", the following example of a nested ordered list is given: 1. Step 1
2. Step 2
3. Step 3
1. Step 3.1
2. Step 3.2
3. Step 3.3 This example shows that Bitbucket expects the list content to be indented with 4 spaces.
This example is rendered as expected on Bitbucket but remark-lint will report errors like: warning Unexpected `2` spaces between list item marker and content, expected `1` space, remove `1` space list-item-indent remark-lint Fixing these errors gives the following Markdown content: 1. Step 1
2. Step 2
3. Step 3
1. Step 3.1
2. Step 3.2
3. Step 3.3 But doing this will cripple the Bitbucket HTML rendering which will display all the list elements at the same level, i.e.: <ol>
<li>Step 1</li>
<li>Step 2</li>
<li>Step 3</li>
<li>Step 3.1</li>
<li>Step 3.2</li>
<li>Step 3.3</li>
</ol> Is this the expected behavior? |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 1 reply
-
BitBucket is not implementing commonmark |
Beta Was this translation helpful? Give feedback.
-
Hello @ChristianMurphy, thank you for your answer. Still, I'm not sure how to interpret this as I can put both versions in the commonmark's reference parser, it doesn't seem to complain on either of them and renders the exact same result in both cases. Here is the result for the "Bitbucket version": So how does this rule out the "Bitbutcket version"?
|
Beta Was this translation helpful? Give feedback.
-
TL;DR
Answers to your questions
If you have the option, I recommend sticking with CommonMark-compliant formatting (single space after markers; indent subcontent by W + 1) for portability across parsers. If you are bound to Bitbucket’s renderer, standardize on “two spaces after the marker + 4 spaces for nested content” and adjust lint accordingly. |
Beta Was this translation helpful? Give feedback.
TL;DR
Both of your snippets are valid CommonMark.
In CommonMark, the space after a list marker can be 1-4. The indentation required for any following lines (including sublists) is W + N, where W is the width of the marker (e.g.,
1.
→ 2 chars) and N is the spaces after it.That’s why both:
(N = 1 → continuation/subcontent indent must be W+N = 3)
and
(N = 2 → co…