[Pipe Tables Extension] Rendering tables when delimiter row is invalid
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 5.3k
- Forks
- 510
- Avg merge
- 8d 5h
- Merged PRs (30d)
- 5
Description
I found another aspect where the pipe tables extension is doing things differently than what GitHub-flavored Markdown suggests. While we're at it, maybe we can get another tweak in for a more GFM-compliant way of processing? 🙂
This is the example I'm talking about:
The header row must match the delimiter row in the number of cells. If not, a table will not be recognized
In other words, a table like this should not be recognized as a table because the delimiter row doesn't match the number of header cells.
| abc | def |
| --- |
| bar |
Markdig would still render the structure given above as a table with two columns.
With the new gfm-pipetables mode in place I managed to get a failing test to reproduce the issue but I'm unsure where to get the fix in. In my mind, the check would go somewhat like this:
- tokenize header row
- tokenize delimiter row
- compare length of both and bail if the length isn't equal
There might be another way to do this that's more in line with the current architecture, though. I'm happy to work on a fix for this issue but would appreciate some ideas to get started.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the failing test reproduced under the gfm-pipetables mode, then read the pipe tables extension's current header and delimiter-row processing. Compare the behavior with GFM example 203; done means the sample with mismatched header and delimiter cell counts is not recognized as a table and the regression test passes.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100