simov / markdown-viewer

Markdown Viewer / Browser Extension
MIT License
1.05k stars 133 forks source link

line breaks in CJK #127

Closed wow-yes closed 11 months ago

wow-yes commented 4 years ago

Hi, Simov.

There is no space between words in Chinese, Japanese and Korean. So when I turn off "breaks" under the compiler REMARK, the viewer add spaces automatically. It will be wired for CJK.

So plz add extra options for CJK, like "east_asian_line_breaks" in pandoc.

Thanks.

simov commented 4 years ago

Can you add a little code snippet here that I can use to reproduce the issue. Even if it is as simple as this one, it can be helpful.

wow-yes commented 4 years ago

For example:

This is my md file:

Markdown-Viewer是浏览器上最好的Markdown预览插件,能够对Md文件进行高度定制化的预 览,支持众多选项设置,易于安装,免费开源。

The sentence was broken into two lines when more than 80 characters. I set the hard wrap in my vimrc.

This is the rendering result:

Markdown-Viewer是浏览器上最好的Markdown预览插件,能够对Md文件进行高度定制化的预_览,支持众多选项设置,易于安装,免费开源。

When this file was render in the Edge, it will add a space automatically between "预" and "览", where the underline shows.

It is useful for English words, but not necessary for Chinese words.

Thanks for your help.

simov commented 4 years ago

It looks like this is a browser behavior, you can read about it here.

Remark seems to have a plugin for that https://github.com/purefun/remark-join-cjk-lines

simov commented 11 months ago

Markdown Viewer v5.2 got released with a new default compiler called markdown-it and also with an option called cjk that addresses this issue https://github.com/simov/markdown-viewer#compiler-options