mirror of
https://github.com/xoofx/markdig.git
synced 2026-02-17 22:02:53 +00:00
[PR #455] [MERGED] Pipe Tables: Normalize using header column count #1042
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/xoofx/markdig/pull/455
Author: @hamvocke
Created: 7/30/2020
Status: ✅ Merged
Merged: 7/30/2020
Merged by: @xoofx
Base:
master← Head:master📝 Commits (5)
8fa4742change test for pipe table normalization0eab0a3set up example006 of pipe table spec according to new behaviorbe53e77remove extra cells, use header row to find maxColumn4390ff2add option to PipeTableOptions, use for normalizationcb0b3a6add 'gfm-pipetables' pipeline mode, introduce new gfm test spec📊 Changes
9 files changed (+1541 additions, -7 deletions)
View changed files
➕
src/Markdig.Tests/Specs/PipeTableGfmSpecs.generated.cs(+857 -0)➕
src/Markdig.Tests/Specs/PipeTableGfmSpecs.md(+617 -0)📝
src/Markdig.Tests/Specs/PipeTableSpecs.generated.cs(+1 -1)📝
src/Markdig.Tests/Specs/PipeTableSpecs.md(+1 -1)📝
src/Markdig/Extensions/Tables/PipeTableOptions.cs(+13 -1)📝
src/Markdig/Extensions/Tables/PipeTableParser.cs(+8 -1)📝
src/Markdig/Extensions/Tables/Table.cs(+39 -2)📝
src/Markdig/MarkdownExtensions.cs(+4 -1)📝
src/SpecFileGen/Program.cs(+1 -0)📄 Description
This is a potential fix for #454.
In this PR I'm introducing
PipeTableOptions.UseHeaderForColumnCount, an option that allows switching the PipeTables extension's normalization behavior. It's defaulting to the current behavior (find the row with the most columns and make sure all other rows have the same amount of cells). When setting this option totrue, the normalization will follow the example in GitHub's spec and remove/add cells in all rows until they match the number of cells in the header row.I'm adding this as a draft PR for now since I need some guidance around the test suite:
Right now, I've changed the markdown example specs to conform to the new behavior and made the new behavior the default. Ideally, we'd have tests for both, the current and the new behavior - I just don't know how to do this. Does the markdown spec notation allow us to specify certain options to be used for the
MarkdownPipeline?🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.