Skip to content

Remove line break in CJK text. #90

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
thynson opened this issue Oct 18, 2012 · 4 comments · Fixed by #3629
Closed

Remove line break in CJK text. #90

thynson opened this issue Oct 18, 2012 · 4 comments · Fixed by #3629

Comments

@thynson
Copy link

thynson commented Oct 18, 2012

First, sorry for my poor English.
One thing annoying me is

你好!
谢谢

will be render to

<p>你好!
谢谢</p>

In the browser a space will appears between "你好!" and "谢谢" when page are rendered.
This is fine in English and those languages seperate words by space. However for Chinese, Japanese and Korean, the extra line break(which will rendered as a space) is not nessaray.

P.S. I know actually this issue is of markdown specs, but I use marked in my project, so I report this issue here. Ugly workaround exists for me, but I wish to have it as a feature of marked.

@tiye
Copy link

tiye commented Oct 26, 2012

Similar Issue: #51

@chjj
Copy link
Member

chjj commented Jan 8, 2013

GFM line breaks can do this now that they've been added. Use breaks: true.

@chjj chjj closed this as completed Jan 8, 2013
@chirsz-ever
Copy link
Contributor

chirsz-ever commented Feb 26, 2025

This issue did not be resolved.

When the Markdown input is like that (no extra whitespace before newline):

你好
谢谢

The rendered visual result would be (I use to replace the invisible whitespace):

你好␣谢谢

For CJK, the whitespace is not expected. This behavior works fine for writing systems that use spaces to separate words, but not for Chinese or Japanese1. breaks: true cannot solve the problem, it just replace newline to <br/>.

The current behavior conforms to CommonMark. We may solve the problem with an extension or a plugin, like markdown-it-cjk-breaks and pandoc's east_asian_line_breaks.

More discussions:

Could you please reopen this issue?


For people coming from search engines: You can use marked-cjk-breaks.

Footnotes

  1. Korean has spaces to separate words.

@UziTech
Copy link
Member

UziTech commented Feb 26, 2025

We use our open issues like a backlog of things we could work on in marked. It sounds like creating an extension is the way to go, so there is nothing to work on in marked.

Once you create the extension you can open a PR to add the extension to our known extensions. 😁👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants