Table reflow

Version 0.5.0 Updated Jul 27, 2026

mdtablefix reformats Markdown pipe tables so each column is aligned to a uniform width. The formatter measures each cell using Unicode display width, which means accented characters, CJK glyphs, and emoji stay visually aligned after reflow.

Continuation rows are preserved during reflow. When a row starts with empty leading cells because its content continues from the previous row, those empty cells keep their original column positions instead of collapsing into the first non-empty cell.

When a table run is followed by a line that opens a new Markdown block — such as a bullet list item, blockquote, link reference definition, or footnote definition — mdtablefix flushes and reflows the buffered table before the new block is processed. This applies even when the block-opening line itself contains a pipe character; it is not treated as a table continuation row. For example, after a table, > quote | with pipe starts a blockquote rather than extending the table.

Pipe-looking lines indented by four or more columns are preserved as indented code blocks. For example, a source line with four leading spaces before | not | a table | is emitted verbatim rather than being table-reflowed.

Content inside fenced code blocks is treated the same way. A line beginning with | inside such a block — for example a shell pipeline continuation such as | tee /tmp/test.log — is never treated as a Markdown table row and never gains an appended trailing |.

Literal pipe characters inside cells must be written as \|. mdtablefix preserves that escaping during reflow, so a literal pipe remains part of the cell content rather than being interpreted as a column boundary.