Skip to content

CJK characters cause table column misalignment #575

@MichaelC001

Description

@MichaelC001

Description

When rendering markdown tables containing CJK (Chinese/Japanese/Korean) characters, the column borders become misaligned. The plugin calculates CJK characters as width 1 instead of width 2 (their actual display width in monospace fonts).

Screenshots

Neovim with render-markdown.nvim:
(image to be added)

Terminal (raw markdown, correctly aligned):
(image to be added)

Markdown Source

| 类型     | 方法                       | 效果     |
|----------|----------------------------|----------|
| Forward  | e.concat(this._dataList)   | 左边显示 |
| Backward | this._dataList.concat(e)   | 右边显示 |

Problem

  • CJK characters have display width of 2 in monospace fonts
  • The plugin calculates them as width 1
  • This causes the right border | to shift left
  • My font renders CJK and ASCII correctly aligned - this is not a font issue, but a width calculation issue in the plugin

Expected Behavior

Table borders should align correctly. The plugin should use vim.fn.strdisplaywidth() or similar to calculate actual display width instead of byte length or character count.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions