You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
usingMarkdig;varinput=@"Here is the table:| Key | Value || ---- | -------- || Color | Blue || Size | Medium |";varpipeline=newMarkdownPipelineBuilder().UsePipeTables().Build();varhtml=Markdown.ToHtml(input,pipeline);Console.WriteLine(html);
It prints single paragraph without converting the table to html:
<p>Here is the table:
| Key | Value |
| ---- | -------- |
| Color | Blue |
| Size | Medium |</p>
If we just add new line after the Here is the table: part:
usingMarkdig;varinput=@"Here is the table:| Key | Value || ---- | -------- || Color | Blue || Size | Medium |";varpipeline=newMarkdownPipelineBuilder().UsePipeTables().Build();varhtml=Markdown.ToHtml(input,pipeline);Console.WriteLine(html);
then everything gets converted properly:
<p>Here is the table:</p><table><thead><tr><th>Key</th><th>Value</th></tr></thead><tbody><tr><td>Color</td><td>Blue</td></tr><tr><td>Size</td><td>Medium</td></tr></tbody></table>
This is different from how other Markdown libraries are rendering it. It is also different from how Github renders it. If I just paste Markdown code from the first example in the text of this issue we properly rendered table:
Here is the table:
Key
Value
Color
Blue
Size
Medium
Let me know if more information is needed.
The text was updated successfully, but these errors were encountered:
When markdig was implemented, it was based on pandoc behavior. The parsing of pipe tables is a complicated beast, and as this library is mainly in maintenance mode, I won't take the time to fix it, but if someone is brave enough, a PR is welcome.
But if a table doesn't start with a column delimiter, it is not interpreted as a table, even if following lines have a column delimiter
But I can't find where it could possibly come from in the pandoc specs.
GFM is different, and not only in this aspect:
It requires the header row to match the delimiter row in the number of cells. All subsequent rows are normalized to this number, not the maximum number of cells. If a row contains more cells than the header, extra cells are simply ignored, with all their contents.
Once started with the header and the delimiter row, the table ends only with an empty line or at the beginning of another block structure. Thus, it accepts lines that contain no pipes as single cells.
So what behavior is currently expected (or desired)?
Consider a following piece of code:
It prints single paragraph without converting the table to html:
If we just add new line after the
Here is the table:
part:then everything gets converted properly:
This is different from how other Markdown libraries are rendering it. It is also different from how Github renders it. If I just paste Markdown code from the first example in the text of this issue we properly rendered table:
Here is the table:
Let me know if more information is needed.
The text was updated successfully, but these errors were encountered: