markdown-viewer icon indicating copy to clipboard operation
markdown-viewer copied to clipboard

line breaks in CJK

Open wow-yes opened this issue 5 years ago • 3 comments

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.

wow-yes avatar Aug 20 '20 07:08 wow-yes

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.

simov avatar Aug 20 '20 07:08 simov

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.

wow-yes avatar Aug 20 '20 13:08 wow-yes

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 avatar Aug 22 '20 11:08 simov

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

simov avatar Sep 27 '23 07:09 simov