Subject: bug#69344: ELPA process collapses Markdown fenced code block into 1 line for HTML page

From: Philip Kaludercic <[email-masked]>
Date: Sat, 24 Feb 2024 09:57:55 +0000

Okamsn <[email-masked]> writes:

> Hello,
>
> While working on adding my package to Non-GNU ELPA, I noticed that the 
> `make build/loopy` process collapsed the fenced code blocks in the file 
> "CHANGELOG.md" into 1 line in the HTML output.
>
> I have attached the Markdown file "CHANGELOG.md" and the outputted file 
> "loopy.html". The squashed code blocks can be seen towards the end of 
> the HTML file when viewed in EWW and Chromium.

(In case anyone else is confused by the same thing as I was, apparently
Gnus renders the code blocks and removed the backticks.)

> Thank you.

[...]

>   ```emacs-lisp
>   ;; Now correct behavior (would previously error):
>   ;; => 6
>   (loopy (list i '(1 2 3))
>          (reduce i #'*))
>   ```

Elpa-admin.el uses the original markdown implementation by John Gruber
or markdown2 (https://pypi.org/project/markdown2/) to render Markdown,
which apparently doesn't handle formatted code blocks:

--8<---------------cut here---------------start------------->8---
$ markdown

```emacs-lisp
 ;; Previously erroneously returned 27:
 ;; => nil
 (loopy (with (val 27))
        (list i '(1 2 3))
        (find val nil (> i 10) :on-failure nil)
        (finally-return val))
```

<p><code>emacs-lisp
 ;; Previously erroneously returned 27:
 ;; =&gt; nil
 (loopy (with (val 27))
        (list i '(1 2 3))
        (find val nil (&gt; i 10) :on-failure nil)
        (finally-return val))
</code></p>
--8<---------------cut here---------------end--------------->8---

or rather it handles them as regular fixed-with formatting sequences.
The quick fix would just be to use classical indented code-blocks, but
it would be worth considering a more robust and predictable markdown
implementation like cmark.