Simple table normalization strips all table symbols #550

Open
opened 2026-01-29 14:39:27 +00:00 by claunia · 0 comments
Owner

Originally created by @ricardoboss on GitHub (Jul 27, 2022).

Hi, great project!

I use markdig in a project to normalize incoming Markdown files and to gather metadata about the document. Now some of these documents include tables and I noticed that they are not rendered at all (I use a JS renderer for markdown, but that one works just fine). As it turns out, markdig seems to strip all table symbols in the normalization step.

I have a reproduction, which closely resembles the actual code used: https://github.com/ricardoboss/markdig-table-normalization

The gist of it is this:

Program.cs

var markdownPipeline = new MarkdownPipelineBuilder()
    .UsePipeTables()
    .Build();

var content = File.ReadAllText("test.md");
var document = Markdown.Parse(content, markdownPipeline);
var builder = new StringBuilder();
var writer = new StringWriter(builder);
var renderer = new NormalizeRenderer(writer);
renderer.Render(document);

Console.Write(builder.ToString());

test.md

| Col | Col 2 | Col 3 |
|:----|:-----:|------:|
| left | center | right |
| spaaaaaaaaacer | spaaaaaaaaacer | spaaaaaaaaacer |

And I expected the output to be same or somewhat formatted, but the actual output is this:

ColCol 2Col 3leftcenterrightspaaaaaaaaacerspaaaaaaaaacerspaaaaaaaaacer
Originally created by @ricardoboss on GitHub (Jul 27, 2022). Hi, great project! I use markdig in a project to normalize incoming Markdown files and to gather metadata about the document. Now some of these documents include tables and I noticed that they are not rendered at all (I use a JS renderer for markdown, but that one works just fine). As it turns out, markdig seems to strip all table symbols in the normalization step. I have a reproduction, which closely resembles the actual code used: https://github.com/ricardoboss/markdig-table-normalization The gist of it is this: `Program.cs` ```csharp var markdownPipeline = new MarkdownPipelineBuilder() .UsePipeTables() .Build(); var content = File.ReadAllText("test.md"); var document = Markdown.Parse(content, markdownPipeline); var builder = new StringBuilder(); var writer = new StringWriter(builder); var renderer = new NormalizeRenderer(writer); renderer.Render(document); Console.Write(builder.ToString()); ``` `test.md` ```markdown | Col | Col 2 | Col 3 | |:----|:-----:|------:| | left | center | right | | spaaaaaaaaacer | spaaaaaaaaacer | spaaaaaaaaacer | ``` And I expected the output to be same or somewhat formatted, but the actual output is this: ``` ColCol 2Col 3leftcenterrightspaaaaaaaaacerspaaaaaaaaacerspaaaaaaaaacer ```
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/markdig#550