keepcalculator

06 Numbers and Powers

Markdown Table Bug Recurring Across Tools: Why

Card No. 06·8697 · Updated · Standard formula, shown below

Average pace 5.00 min/km
Average speed
12.00 km/h
Result
Finish time
50 min
You entered
Distance
10 km
You entered
You enter
Finish time, Distance
You get
Average pace, Average speed
Rounding
2 dp

Markdown table bugs keep returning across different tools because most Markdown parsers are lenient by design, tolerating malformed tables and then rendering them inconsistently, so a table that works in one editor silently breaks in another. The root cause is that Markdown’s table syntax is not an official part of the original specification—it comes from a 2004 extension called PHP Markdown Extra—and every parser implements its own quirks, leading to a fragmented ecosystem where the same table can look perfect, collapse, or fail entirely depending on the tool. This article explains the technical reasons behind these recurring bugs, how to diagnose them, and practical steps to make your tables portable.

Formula

The calculator above computes running pace and speed from a finish time and distance. The formulas are:

  • Average pace (min/km) = finish time (minutes) ÷ distance (km)
  • Average speed (km/h) = distance (km) ÷ (finish time (minutes) ÷ 60)

Variables: t = finish time in minutes (input), d = distance in kilometers (input). Outputs are pace in minutes per kilometer and speed in kilometers per hour, both rounded to two decimals.

Worked Example

Using the default values: finish time = 50 minutes, distance = 10 km.

  1. Pace = 50 ÷ 10 = 5.00 min/km
  2. Speed = 10 ÷ (50 ÷ 60) = 10 ÷ 0.8333 = 12.00 km/h

The calculator shows 5.00 min/km and 12.00 km/h, matching these steps.

Why Markdown Tables Are Inherently Fragile

Markdown was designed in 2004 by John Gruber as a lightweight markup language that converts plain text to HTML. The original spec deliberately omitted tables, leaving them to third-party extensions. The most influential extension, PHP Markdown Extra by Michel Fortin, introduced pipe-delimited tables. This syntax spread to GitHub Flavored Markdown (GFM), CommonMark, and countless editors, but each implementation added its own rules for alignment, escaping, and cell content. Because there is no single authoritative standard for tables, a table that relies on a feature specific to one parser—like inline HTML in a cell or a trailing pipe—will break in another. This is why you see the same bug reappear: you fix it in one tool, copy the table to another, and the new parser interprets the pipes differently.

How Different Parsers Handle Tables Differently

The most common divergence is the header row separator. In GFM, a table requires a delimiter row like | --- | --- | directly after the header. Some parsers accept a single dash, others require at least three, and some ignore the row entirely if there are extra spaces. Alignment colons (:---:) are another pain point: not all parsers support them, and those that do may render them as left-aligned if the colon is misplaced. Cell content also varies: some parsers allow block elements like lists or code blocks inside a cell, while others flatten everything to a single line. Escaping a literal pipe (\|) works in most parsers, but a few treat the backslash literally. These subtle differences mean a table that renders correctly in your IDE’s preview may lose its borders or merge columns when you push it to a wiki, a static site generator, or a chat app.

Common Mistakes That Trigger the Same Bug

Most recurring table bugs trace back to a handful of errors that are easy to make and hard to spot visually:

  • Missing delimiter row – Without a | --- | row, the parser treats the table as plain paragraphs.
  • Inconsistent column count – A row with fewer or more pipes than the header breaks alignment; many parsers silently drop extra cells.
  • Trailing spaces after pipes – Some parsers trim them, others include them in the cell, causing unexpected line breaks.
  • Using tabs instead of spaces – Tabs inside cells can be expanded differently, shifting columns.
  • Escaping pipes incorrectly – A backslash before a pipe works in GFM but may not in older parsers.
  • Copying from a rendered view – Copying the HTML output instead of the raw markdown introduces invisible tags.

These mistakes are often invisible in a live preview because the parser auto-corrects minor issues, but the same table fails on a stricter parser.

How to Diagnose and Fix a Recurring Table Bug

When a table breaks in a new tool, follow these steps to isolate the cause:

  1. Validate the raw markdown – Paste the table into a CommonMark reference implementation (like the online dingus) to see if it conforms to the baseline spec.
  2. Check the delimiter row – Ensure it has at least three dashes per column and no spaces inside the dashes.
  3. Count pipes in every row – Use a text editor with column highlighting to verify each row has the same number of pipes.
  4. Remove alignment colons – If the table works without them, the parser may not support alignment.
  5. Replace tabs with spaces – Convert all tabs to spaces (typically 4) and re-test.
  6. Simplify cell content – Remove any inline HTML, links with pipes, or multi-line content, then add them back one by one.

If the bug persists, the issue is likely a parser-specific feature. Search the tool’s documentation for “tablesâ€� and check which extension it follows (GFM vs. CommonMark vs. custom).

Portable Table Syntax: What Works Everywhere

To avoid the bug entirely, write tables using the lowest common denominator syntax that all major parsers support:

  • Use a single pipe | as the column separator, with no extra spaces around it (though spaces are allowed).
  • Include a delimiter row with three or more hyphens per column, no colons.
  • Keep every cell on a single line, with no blank lines inside the table.
  • Avoid escaping pipes unless absolutely necessary; instead, use the HTML entity | for a literal pipe.
  • Do not rely on alignment; assume left-aligned by default.

This minimal syntax renders correctly in GitHub, GitLab, Bitbucket, Stack Overflow, most static site generators (Jekyll, Hugo, MkDocs), and popular editors like VS Code and Obsidian. If you need advanced features like alignment or block content, test the table in the target tool before committing.

Why the Bug Keeps Returning Across Your Tools

The reason the same bug follows you is that you are likely copying tables between tools that use different parser versions or extensions. For example, a table you create in Typora (which uses a custom parser) may rely on Typora’s auto-formatting that adds alignment colons. When you paste that into a GitHub issue, GFM’s parser handles the colons fine, but if you then move it to a plain Markdown file processed by Python-Markdown, the colons may be ignored or cause a misalignment. Additionally, many modern editors have “smartâ€� features that automatically insert a delimiter row or adjust column widths, but these edits are not reflected in the raw text—or they introduce invisible characters. The bug is not a single defect but a mismatch between the parser’s assumptions and your table’s implicit reliance on a previous parser’s behavior. The only permanent fix is to standardize your table syntax and test it in a neutral environment before sharing.

Frequently Asked Questions

Why does my table work in VS Code but not on GitHub?

VS Code’s built-in Markdown preview uses a specific parser (markdown-it) that is lenient about missing delimiter rows and extra spaces. GitHub uses its own fork of CommonMark with GFM extensions, which is stricter about column counts and requires a delimiter row. The same raw text is interpreted differently, so a table that renders in VS Code may be treated as plain text on GitHub.

How do I fix a table that shows as plain text in a chat app like Slack or Discord?

Slack and Discord do not support Markdown tables at all—they strip pipes and render the content as plain text. There is no fix within the app; you must either use a code block with a monospace font or convert the table to an image. Check the app’s documentation first, as some chat apps have added table support recently.

What is the difference between GFM and CommonMark tables?

CommonMark is a standardized Markdown spec that does not include tables. GFM is a superset of CommonMark that adds tables, task lists, and strikethrough. GFM tables require a delimiter row and support alignment colons, but CommonMark-only parsers (like some static site generators) will not render tables at all unless they explicitly enable the extension.

Can I use HTML tables inside Markdown?

Yes, Markdown allows raw HTML, so you can write a full HTML <table> block. This works in most parsers that allow inline HTML, but it is verbose and may be sanitized by platforms like GitHub (which strips certain tags). It is a reliable fallback for complex tables, but test it in your target tool.

Why does my table lose its borders when I export to PDF?

PDF export often uses a different rendering engine than the live preview. Many Markdown-to-PDF converters (like Pandoc) use LaTeX, which requires a specific table package and may not support pipe tables without conversion. The borders disappear because the converter interprets the table as a simple grid without styling. Use a dedicated Markdown-to-PDF tool that supports GFM tables, or adjust the converter’s settings.

Is there a way to make tables bulletproof across all tools?

No, because no universal table syntax exists. The closest is to use the minimal GFM syntax described above and avoid any advanced features. For mission-critical documents, consider using a format like reStructuredText or AsciiDoc, which have more rigorous table specifications, or generate the table from a CSV file using a script.

Related

Formula used
in t | Finish time | min | 50 | 0
in d | Distance | km | 10 | 0 | 100000
out pace | Average pace | min/km | t / d | 2
out speed | Average speed | km/h | d / (t / 60) | 2

Each line is one input (in, sel, list) or one result (out: label, unit, formula, decimals). How the calculators work

Method: the standard formula for this calculation, rounded as each result states. See how the calculators work or report an error.

More cards in this drawer

The whole Numbers and Powers drawer →