PipeTable fails to process table when empty code blocks are present #675

Closed
opened 2026-01-29 14:42:43 +00:00 by claunia · 2 comments
Owner

Originally created by @agr on GitHub (May 9, 2024).

Run the following code:

using System;
using Markdig;
namespace MarkDigTableTest
{
    internal class Program
    {
        static void Main(string[] args)
        {
            var md = @"
| h1 | h2 |
|----|----|
| v1 | `` |
| v2 | `` |
";
            var mp = new MarkdownPipelineBuilder()
                .UsePipeTables()
                .Build();
            var html = Markdown.ToHtml(md, mp);
            Console.WriteLine(html);
        }
    }
}

It produces the following output:

<p>| h1 | h2 |
|----|----|
| v1 | <code>| | v2 |</code> |</p>

I.e. it fails to render the table as an HTML table. Removing any of the rows or putting something inside any backtick pairs makes it work as expected.

Originally created by @agr on GitHub (May 9, 2024). Run the following code: ```C# using System; using Markdig; namespace MarkDigTableTest { internal class Program { static void Main(string[] args) { var md = @" | h1 | h2 | |----|----| | v1 | `` | | v2 | `` | "; var mp = new MarkdownPipelineBuilder() .UsePipeTables() .Build(); var html = Markdown.ToHtml(md, mp); Console.WriteLine(html); } } } ``` It produces the following output: ``` <p>| h1 | h2 | |----|----| | v1 | <code>| | v2 |</code> |</p> ``` I.e. it fails to render the table as an HTML table. Removing any of the rows or putting something inside any backtick pairs makes it work as expected.
Author
Owner

@MihaZupan commented on GitHub (May 9, 2024):

Likely a duplicate of #176

Note that

``

in markdown is not an empty code inline, but the start of one that is delimited by two backticks. E.g. so that you can do

``this is text with `a code inline` in the middle``
@MihaZupan commented on GitHub (May 9, 2024): Likely a duplicate of #176 Note that ``` `` ``` in markdown is not an empty code inline, but the start of one that is delimited by two backticks. E.g. so that you can do ``` ``this is text with `a code inline` in the middle`` ```
Author
Owner

@agr commented on GitHub (May 9, 2024):

Makes sense, especially since it happens when they come in pairs.

@agr commented on GitHub (May 9, 2024): Makes sense, especially since it happens when they come in pairs.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/markdig#675