Markpad
Markpad copied to clipboard
Incorrect character count for Chinese / CJK text
How did you install Markpad?
None
App version
2.7.4
OS and version
win10
Linux only: distribution, session and GPU/driver
No response
What happens
The bug is shown as follows:
It fails to take CJK characters into account.
What you expected
In my opinion, the total number of characters in the above‑mentioned document should be 12 + 18 = 30.
Steps to reproduce
No response
The document, if one triggers it
No response
Screenshots
No response
Anything else
No response
这不是 bug,是行内公式定界符的通用规则:开头的 $ 右边不能是空格,结尾的 $ 左边不能是空格。
$a = \frac{b}{c}$ ✅ $ a = \frac{b}{c} $ ❌
这条规则不是 Markpad 自己定的。Pandoc 的文档明确写着这一条,GitHub、Typora、Obsidian 的行内公式也都是同样的要求。
原因是 $ 在正文里最常见的用途是货币。如果允许开头的 $ 后面跟空格,价格在 $ 5 到 $ 10 之间 这样一句话就会被整段吞成一个公式。Markpad 的测试里就钉着这个 case。
去掉两侧的空格即可正常渲染。