Possible regression in v0.55.5 regarding lists containing code blocks

I tried upgrading from v0.54.0 to v0.55.5, hoping to see some bugs fixed with blackfriday update. Instead, the following issue occurs for lists that include code blocks.

Say we have the following MD source: (code fences can be replaced with highlight shortcodes)

1. Step #1 description

    ```bash
    blahblah
    ```

2. Step #2 description

    ```bash
    blahblah
    ```

3. Step #3 description

    ```bash
    blahblah
    ```

4. Step #4 description

    ```bash
    blahblah
    ```

In v0.54.0, output shows the list rendered in order as expected.

In v0.55.5, however, output makes the list scrambled as follows:

1. Step #1 description
    
    blahblah

    1. Step #2 description
        
    blahblah
       
2. Step #3 description
    
    blahblah
   
    1. Step #4 description
        
    blahblah

I’m testing with the extended version for macOS. If someone confirms that this problem is not isolated to my environment, I’ll file a GitHub issue for this.

Added note: https://github.com/russross/blackfriday/issues/239 is still reproducible on v0.55.5 despite the blackfriday update.

1 Like

I am suffering from this too. It seems to be introduced by https://github.com/gohugoio/hugo/pull/5912. The upstream regression that I reported has no response https://github.com/russross/blackfriday/issues/484.

1 Like

It seems like this issue has been somehow fixed in v0.56.0. FYI: @heavywatal

Thank you @jkboxomine for letting me know. I have confirmed that this issue has been “somehow” fixed. But the current origin/HEAD has another problem that a list doesn’t end properly when it is followed by a code block. For example,

-   item 1
-   item 2

```
This block should be out of <ul>...</ul>
```

ends up with the HTML that includes the code block in the item 2.

1 Like

I can’t find the exact reference, but adding <!-- end list --> after the last list item might be helpful in such a case.

-   item 1
-   item 2

<!-- end list -->

```
This block should be out of <ul>...</ul>
```
2 Likes

I confirm that bug. Please open an issue with this example on the Blackfriday repo.

@jkboxomine I also confirm that workaround :slight_smile:

OK, I have opened this issue here:

2 Likes

At least this issue is fixed for ox-hugo users in its latest update :slight_smile:

Given an Org source:

* Source block following a list                         :src_block:@upstream:
:PROPERTIES:
:EXPORT_FILE_NAME: src-block-following-a-list
:END:
#+begin_description
Test to verify rendering of a source block immediately following a
plain list, and even a list following a heading following a source
block.
#+end_description

- [[https://discourse.gohugo.io/t/rendering-code-blocks-properly-from-md-files/19126][Ref 1]]
- [[https://discourse.gohugo.io/t/possible-regression-in-v0-55-5-regarding-lists-containing-code-blocks/18502/4?u=kaushalmodi][Ref 2]]
- {{{bfissue(556)}}}


- list item 1
- list item 2
#+begin_src nim
echo "hello"
#+end_src
- another list item 1
- another list item 2
** A heading in post
#+begin_src nim
echo "hello again"
#+end_src

, it generates this Markdown now, which Hugo/Blackfriday renders as this.