AppCrib
Developer Tools

How to Format Markdown Tables with CJK Characters (Without the VS Code Extension Bug)

Launch·Published by AppCrib··
PipefmtPaste a messy table. Get a perfect one. Instantly.

How do I fix Chinese, Japanese, or Korean column alignment in markdown tables?

Use a markdown table formatter that counts full-width CJK characters as two monospace columns instead of one. Pipefmt does this in the browser with a live preview. Paste a table mixing English and 中文, and the pipes line up on the first pass. The popular VS Code extension (326k installs) has a known bug where CJK columns drift a space or two per row, which is why your tables keep looking crooked after you format them.

That is the short version. The rest of this post covers why the bug exists, how to work around it without installing anything, and what a CJK-aware formatter actually does under the hood.

Why do markdown tables break when they contain CJK characters?

Markdown tables are plain text. A renderer like GitHub or Obsidian only cares about pipe counts and the separator row. A human reading the raw source cares about visual alignment, which depends on monospace display width, not character count.

Most markdown table formatters count each character as one column. That is correct for ASCII. It is wrong for full-width CJK characters, which occupy two columns in every monospace font. If your formatter treats one character as one column, every CJK cell ends up a column short. The pipe on the right side of that cell drifts left, and the row below it no longer matches.

The fix has a name: East Asian Width. It is a Unicode property that tags every codepoint as narrow, wide, half-width, or full-width. If your formatter reads that property, the widths come out right. If it ignores the property, it treats 漢 the same as A and the table comes out crooked.

Why does the VS Code Markdown Table Prettifier get this wrong?

Markdown Table Prettifier is the most-installed markdown table formatter on the VS Code marketplace. 326k installs. Five stars. It ships in CI pipelines through MegaLinter. It is also why your CJK tables look broken.

The extension uses raw string length for width calculation. For pure ASCII tables that works. The moment a cell contains a full-width character, the column math is off. The bug has been open for years. The extension ships about once every four years, so a fix is not close.

If you write documentation in Chinese, Japanese, or Korean, this turns into a real problem. You format a table, look at the output in your editor, and see columns that appear misaligned even though the markdown renderer handles it fine. Contributors will keep "fixing" your tables and making them worse because the tool is lying to them about widths.

How does Pipefmt handle CJK alignment correctly?

Pipefmt measures column width using the East Asian Width Unicode property via the string-width library. Full-width CJK characters count as two. ASCII counts as one. Emoji count as two. Zero-width combining marks count as zero. The math matches what your eyes see in a monospace font.

The formatting engine runs entirely in the browser. No upload, no backend, no wait. Paste a table with 中文, 日本語, or 한국어 content and the output pane refreshes within 300 milliseconds. If the alignment looks wrong in the output, it will look wrong in your source file too. There is no hidden rounding, no fallback math.

Three toggles matter for CJK documentation:

  • Alignment selector: Auto preserves existing alignment markers. Left, center, and right override them.
  • Outer pipes: On by default. Some renderers require them, some style guides forbid them. Pipefmt does either.
  • Padded versus compact: Padded adds a space on each side of every cell value. Compact strips all padding. Padded is the standard; compact is useful when byte count matters.

Can I use a web-based markdown table formatter instead of a VS Code extension?

Yes, and for CJK content you probably should. A web formatter that reads Unicode widths correctly will beat an extension that does not, regardless of which editor you prefer.

The trade-off is workflow. A VS Code extension formats in place with a keyboard shortcut. A web tool needs a paste, a glance, and a copy. For one-off formatting or occasional CJK content, the web flow is fine and often faster than reconfiguring an extension. For constant formatting across dozens of files, you will want both: the extension for ASCII tables, and a CJK-aware web tool for tables with East Asian content.

Pipefmt is free, has no sign-up, works offline after first load, and does not send your table content to any server. Paste, format, copy. That is the whole loop.

What should a live preview markdown table formatter actually show me?

A useful live preview does more than mirror your input in a second text box. It should refresh as you type, surface parse errors inline when your input is malformed, and reflect every formatting option you change without requiring a format button.

Pipefmt debounces input at 300 milliseconds. That is fast enough to feel instant and slow enough to avoid flicker. Parse errors surface as hints next to the input rather than popping up as dialog boxes. Flip the alignment selector or toggle outer pipes and the output redraws immediately, so you can compare variants without copying and re-pasting.

The output pane also flags CJK content explicitly. If your table contains full-width characters, a small green indicator shows that the CJK width logic ran. You do not get that kind of feedback from command-line formatters, and it matters when you are debugging alignment issues across a mixed-language document.

Ready to try it?

Pipefmt is free and ad-supported. No account, no download, no data collection beyond anonymous usage events. Paste your messiest markdown table into pipefmt at appcrib.com and watch it snap into alignment. If you write docs with CJK content, start there. You will see the difference immediately.

Pipefmt
Paste a messy table. Get a perfect one. Instantly.
Try Pipefmt