Skip to content

Fix partially empty pipe table separator regression - #955

Merged
xoofx merged 3 commits into
xoofx:mainfrom
vicancy:vicancy-restore-empty-table-separators
Sep 19, 2026
Merged

xoofx merged 3 commits into
xoofx:mainfrom
vicancy:vicancy-restore-empty-table-separators

Conversation

@vicancy

@vicancy vicancy commented Sep 18, 2026

Copy link
Copy Markdown
Contributor

Summary

Restore Markdig's historical support for individual empty or whitespace-only pipe-table separator cells, while retaining rejection of separator rows with no dashes.

Commit 7959e3b fixed #927 by rejecting pipe-only separator rows. It also changed per-cell validation to reject empty cells, so previously accepted tables such as the following now render as literal paragraphs:

| Field | PersonShared | Person |
| --- | | --- |
| Name | Master | Inherit |

This regression was reported in dotnet/docfx#11147 after its Markdig upgrade. The reporter's follow-up distinguishes a partially empty separator from the entirely pipe-only rows targeted by #927.

This is a backward-compatibility fix, not a strict GFM compliance change: strict GFM requires dashes in each separator cell.

Changes

  • Allow empty/whitespace-only cells in TryParseHeaderColumn, with no explicit alignment and zero dash count.
  • Keep FindHeaderRow's totalDelimiterCount == 0 guard unchanged, preserving the all-pipe-row fix and preventing division by zero when inferring widths. Keep trailing-pipe handling unchanged.
  • Add canonical HTML specs and regenerate their tests for the reported table, first/middle/last empty cells, adjacent pipes, alignment, optional outer pipes, header-only tables, and whitespace-only separator rows.
  • Add inferred-width cases and rejection checks with width inference on/off and with/without a body. Invalid nonempty cells still reject the table.
  • Document the compatibility behavior and zero-width contribution of empty separator cells.

Validation

  • Before the parser fix: the selected .NET 10 table/emoji run had 141 passing tests and 14 expected failures: six new HTML specs (including the reported reproduction) and eight new inferred-width cases.
  • After the fix: all 155 selected table/emoji tests passed on each of .NET 8 and .NET 10.
  • Full Markdig test suite: 3,834 passed, 0 failed, 1 existing ignored test (ListUnorderedLooseTop) on each of .NET 8 and .NET 10.
  • Release library build: succeeded for net462, netstandard2.0, netstandard2.1, net8.0, and net10.0, with 0 warnings and 0 errors.

Commands run from the repository root:

dotnet test .\src\Markdig.Tests\Markdig.Tests.csproj -c Release -f net10.0 --no-restore --filter "FullyQualifiedName~PipeTable|FullyQualifiedName~Emoji"
dotnet test .\src\Markdig.Tests\Markdig.Tests.csproj -c Release --no-restore --filter "FullyQualifiedName~PipeTable|FullyQualifiedName~Emoji"
dotnet build .\src\Markdig\Markdig.csproj -c Release --no-restore
dotnet test .\src\Markdig.Tests\Markdig.Tests.csproj -c Release --no-restore

Validation was on Windows; the documentation site and unrelated solution tools/benchmarks were not built. No dependency or SDK policy changes.

Restore historical acceptance of empty separator cells while retaining the row-wide dash requirement introduced for xoofx#927. Cover partial and entirely empty rows, alignment, optional pipes, and inferred widths.

Refs: dotnet/docfx#11147

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@xoofx
xoofx merged commit ad7cc00 into xoofx:main Sep 19, 2026
3 checks passed
@vicancy
vicancy deleted the vicancy-restore-empty-table-separators branch September 20, 2026 23:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Empty pipe sequences incorrectly parsed as valid tables

2 participants