xoofx / xoofx/markdig

[Pipe Tables Extension] Normalization is inserting extra columns

Open
#454 7 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement PR Welcome!
Dominant language
C#
Stars
5.3k
Forks
510
Avg merge
11d 3h
Merged PRs (30d)
6

Description

I'm working with markdig's Pipe Tables Extension and found a case where the specified behavior around normalization is different from what GitHub-flavored Markdown is specifying.

GFM says:

The remainder of the table’s rows may vary in the number of cells. If there are a number of cells fewer than the number of cells in the header row, empty cells are inserted. If there are greater, the excess is ignored

markdig's pipe tables spec says:

The tables are normalized to the maximum number of columns found in a table


This means, a table like this:

| abc | def |
| --- | --- |
| bar |
| bar | baz | boo |

is supposed to result in an HTML table that's got 2 columns according to GFM. The first body row gets an extra, empty <td> while the second body row doesn't include the boo cell.

Running this example through markdig with pipe tables enabled, however, generates a table that's got 3 columns, with the header and the first body row both gaining empty table cells.

I'm wondering if this deviation from GFM is intentional. Is there a reason why the two specifications treat normalization differently? And would it be desirable to make the normalization behavior configurable, e.g. by passing an option to the pipe tables plugin?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with src/Markdig.Tests/Specs/PipeTableSpecs.md and the linked GFM example, then reproduce the three-row table case. Compare Markdig’s current three-column output with GFM’s expected two-column result; completion requires an agreed decision on retaining the documented behavior or adopting/configuring GFM normalization.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, markdown
Domain
devtools
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.