yzhang-gh / vscode-markdown

Markdown All in One
https://marketplace.visualstudio.com/items?itemName=yzhang.markdown-all-in-one
MIT License
2.9k stars 322 forks source link

Chinese text with :[ does not align properly #1457

Open sati-bodhi opened 1 month ago

sati-bodhi commented 1 month ago

What's the problem

The algorithm fails to work with : when it is followed by 「, which is very common in Traditional Chinese. Font used in this example is Noto Sans Mono CJK TC.

image

What's the expected result

Table columns align properly.

How to reproduce

  1. Input the following and execute Ctrl + Shift + I
| Testing                                               | 123                                                           |
| :---------------------------------------------------- | :------------------------------------------------------------ |
| English content                                       | works.                                                        |
| 中文也可以。                                          | Chinese too.                                                  |
| 「這樣也」可以。                                      |                                                               |
| 你說:「怎麼辦?」                                    | But this doesn't work.                                        |
| :                                                    | Colon alone works.                                            |
| 《書名號》:                                          | Breaks when colon is next to another punctuation...           |
| ::                                                  | ...which is not another colon.                                |
| 你說:「怎麼辦?」我說:「不知道!」《經典》說:「…」 | Alignment gets wild when multiple `「:`s are used in a line. |

Other information

Same issue as https://github.com/takumisoft68/vscode-markdown-table/issues/72#issue-2464831361

sati-bodhi commented 1 month ago

Update: commas ,「, semicolons ;「 when coupled with another punctuation break the alignment as well.

| Testing                                               | 123                                                           |
| :---------------------------------------------------- | :------------------------------------------------------------ |
| English content                                       | works.                                                        |
| 中文也可以。                                          | Chinese too.                                                  |
| 「這樣也」可以。                                      |                                                               |
| 你說:「怎麼辦?」                                    | But this doesn't work.                                        |
| :                                                    | Colon alone works.                                            |
| 《書名號》:                                          | Breaks when colon is next to another punctuation...           |
| ::                                                  | ...which is not another colon.                                |
| 你說:「怎麼辦?」我說:「不知道!」《經典》說:「…」 | Alignment gets wild when multiple `「:`s are used in a line. |
| ,《                                                  |                                                               |