Fenced code blocks inside list (BB-7955)

Issue #6778 open
Dmitry Pashkevich created an issue

The following works:

Unfenced code block with double indentation

  • List item

    .post-list li .author a,
    .post-list li .author a:hover {
        color: #F30;
        text-transform: uppercase;
    }
    
  • Another list item

However this doesn't work as expected

I want highlighting!

  • List item

    ```
    #!css
    
    .post-list li .author a,
    .post-list li .author a:hover {
        color: #F30;
        text-transform: uppercase;
    }
    ```
    
  • Another list item

Look here for reference: Fenced code blocks inside ordered and unordered lists

Comments (25)

  1. edwardfung

    Still no update yet? It really discouraging. Could you just put this "trick" into your help page? waste so much time experiment with the "spaces"

  2. Rinat Akhmadeev

    You can use this for create code block in list:

    - List item:
    
            .post-list li .author a,
            .post-list li .author a:hover {
                color: #F30;
                text-transform: uppercase;
            }
    
    - Next list item
    

    Result:

    • List item:

      .post-list li .author a,
      .post-list li .author a:hover {
          color: #F30;
          text-transform: uppercase;
      }
      
    • Next list item

    But highlighting is wrong, and you can't choose Language.

    Another variant:

    - List item:
    
        ```css
        .post-list li .author a,
        .post-list li .author a:hover {
            color: #F30;
            text-transform: uppercase;
        }
        ```
    
    - Next list item
    

    Result:

    • List item:

      css .post-list li .author a, .post-list li .author a:hover { color: #F30; text-transform: uppercase; }

    • Next list item

    This works very wrong.

    Plase, fix it.

  3. Paul Melnikow

    Think I got this working. It doesn't work with fenced code blocks.

    1. Foo
    
            :::css
            .post-list li .author a,
            .post-list li .author a:hover {
                color: #F30;
                text-transform: uppercase;
            }
    
    2. Bar
    
            :::css
            .post-list li .author a,
            .post-list li .author a:hover {
                color: #F30;
                text-transform: uppercase;
            }
    
    1. Foo

      .post-list li .author a,
      .post-list li .author a:hover {
          color: #F30;
          text-transform: uppercase;
      }
      
    2. Bar

      .post-list li .author a,
      .post-list li .author a:hover {
          color: #F30;
          text-transform: uppercase;
      }
      
  4. Mateusz Łoskot

    Still no fix for the fenced code block as list item? It does not have to be with syntax highlighting support, but just for the plain block.

  5. Amihai Cohen

    Same here. Tried all the suggested workarounds in here and in here, none worked (I'm trying a json snippet in a bulleted list).

  6. Michael Cahill

    Upvoting.. REALLY?!??!

    "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)"

  7. Ale Rimoldi

    I also would love to be able to use the fenced blocks... where I can pick the correct language for my snippet... (also for compatibility with files that are also on other platforms...)

  8. Janardhan Raju

    5 years and still bitbucket did not resolve this issue. Wasted last 3 hours figuring it out that bitbucket doesn't support code blocks in lists.

    @Alastair Wilkes Any plans to support? These are some basic stuff in markdown.

    Bitbucket sleeps on issues for many years.

  9. Antoine Sachet

    +1, wasted a few hours as well trying to get a comment (starting with #) not to become a title despite being in a nested fenced code block...

  10. Log in to comment