[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [gb.markdown] Markdown.ToHTML() does not recognize triple-backtick code fences (```)


Hello,

Normal, because gb.markdown implemente a variant of standard markdown, you should take a look at the documentation.

Olivier

> Le 8 nov. 2026 à 17:46, Alarch <alarch@xxxxxxxxx> a écrit :
> 
> Hello,
> 
> While using gb.markdown (Markdown.ToHTML) in a small internal web project, I noticed that code blocks delimited by triple backticks (``` ... ```) are not recognized as code blocks: each fence line is treated as inline code (a single backtick), which inserts an error message into the produced HTML ("Missing closing '`'") instead of the expected code block. Only 4-space indentation (the original Markdown syntax) works correctly.
> 
> Tested with gambas3-gb-markdown 3.19.5+git202409271332.897eab4fc+build16~ubuntu22.04.1 (component alone, Dim hMd As New Markdown / hMd.ToHTML(sMd)).
> 
> Input:
> Before.
> 
> ```
> some code
> ```
> 
> After.
> 
> Resulting HTML:
> Before.
> <p></p>
> <code style="white-space:nowrap;">`</code><div class="error">Missing closing '`'</div>
> some code
> <code style="white-space:nowrap;">`</code><div class="error">Missing closing '`'</div>
> <p></p>
> After.
> 
> The same content with 4-space indentation gives the expected result:
> Before.
> <p></p>
> <div><pre><code>some code
> </code></pre></div>
> <p></p>
> After.
> 
> Since triple-backtick fences have become the near-univers in Markdown (GitHub, docsify, etc.), it would be nice if
> gb.markdown recognized them too, in addition to indentation, which already works well. In the meantime, I'm working around this in my
> application by rewriting ``` fences into 4-space indentat
> 
> I can provide a minimal test Gambas project if that's use
> 
> Thanks for all the work on Gambas!
> 
> Marc
> 
>