markdown-customblocks icon indicating copy to clipboard operation
markdown-customblocks copied to clipboard

Span-level markdown re-rendered within customblocks

Open GiovanH opened this issue 10 months ago • 0 comments

I'm seeing inconsistent behavior between CB and hand-written HTML, and it's preventing me from rendering <pre> blocks correctly.

Minimal example:

from customblocks.utils import Markdown as cbMarkdown
from customblocks.utils import E as cbE

def cb_pre(ctx, *args, **kwargs):
    return cbE(
        f"pre",
        ctx.content
    )

(Note this is not using cbMarkdown, which does re-render block elements if I substitute it for ctx.content.)

Input markdown:

<pre>
*Don't render me as italic*

- I don't have a markdown list either
</pre>

::: pre
    *Don't render me as italic*

    - I don't have a markdown list either

Output HTML:

<pre>*Don't render me as italic*

- I don't have a markdown list either
</pre>
<pre><em>Don’t render me as italic</em>

- I don’t have a markdown list either
</pre>

Note how the list is not rendered in either case, and the customblock is not wrapped in a <p> block element, but the italics are rendered.

Expected output HTML:

<pre>*Don't render me as italic*

- I don't have a markdown list either
</pre>
<pre>*Don't render me as italic*

- I don't have a markdown list either
</pre>

GiovanH avatar Aug 14 '23 00:08 GiovanH