Skip to content

Register the shipped TableConverter so <table> renders as a markdown table (fixes #38) - #41

Open
namaserajesh wants to merge 1 commit into
ProgressPlanner:mainfrom
namaserajesh:fix/register-table-converter
Open

Register the shipped TableConverter so <table> renders as a markdown table (fixes #38)#41
namaserajesh wants to merge 1 commit into
ProgressPlanner:mainfrom
namaserajesh:fix/register-table-converter

Conversation

@namaserajesh

Copy link
Copy Markdown

Follow-up to my comment on #38 — here is the offered fix as a concrete diff.

The bug

Any post containing an HTML <table> loses all tabular structure in the .md output: league/html-to-markdown's createDefaultEnvironment() registers every converter the library ships except TableConverter (GFM tables are an opt-in extension), so <table> falls through to DefaultConverter, which concatenates cell text with no separators. A 4×3 pricing table arrives as PlanPriceStorageSupportFree$05 GBCommunity… — unrecoverable for the LLM/agent consumers this plugin exists to serve, and tables are among the densest content those consumers can ingest.

Note the root cause is registration, not a missing dependency: the library has shipped TableConverter since 5.0.0 (2021) and already carries the table_pipe_escape / table_caption_side option defaults for it. The fix is one line plus the import.

Verification

We have run exactly this change in production on two WordPress sites since 2026-07-20:

  • 32/32 posts with tables on one site and 14/14 on the other now emit valid GFM pipe tables in their .md alternates (headers, row boundaries, and cell separation all preserved).
  • Cost: about +1.8% markdown size across those posts.
  • No change to posts without tables.

Happy to adjust style/placement to your conventions.

… markdown table

GFM tables are an opt-in extension in league/html-to-markdown, so
createDefaultEnvironment() registers every converter the library ships
EXCEPT TableConverter. Without it, <table> falls through to
DefaultConverter, which concatenates cell text with no separators — a 4x3
pricing table arrives as 'PlanPriceStorageSupportFree$05 GBCommunity...'
and no consumer can recover the grid. Tables are among the densest
content an LLM can ingest, so this is the opposite of the plugin's
purpose.

The library has shipped TableConverter since 5.0.0 (2021) and already
carries table_pipe_escape / table_caption_side defaults for it — only the
registration is missing. One line plus the import.

Fixes ProgressPlanner#38.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant