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

add an extension to handle Chinese (or CJK) newlines. #334

Merged
merged 3 commits into from Apr 13, 2017

Conversation

Projects
None yet
2 participants
@choueric
Contributor

choueric commented Feb 22, 2017

There is a common discussion, for example here, about the difference between English and Chinese when there are linebreaks in a paragraph. Here is a method by adding a extension to join lines.

@rtfb

This comment has been minimized.

Collaborator

rtfb commented Mar 16, 2017

Sorry for the delay to get back to you.

First, please rewrite the test to not need the testdata file. I see no reason for that. Also, move the test to block_test.go.

Also, how does this work with consecutive newline characters (and how should it)? I see from the test that it doesn't join all the input into a single line, but can't immediately see why.

modify testcase of joinLine.
1. delete testdata 'zhJoinLines.txt'.
2. move the testcase from markdown_test.go into block_test.go.
@choueric

This comment has been minimized.

Contributor

choueric commented Mar 17, 2017

Thanks for your suggestion and I did the modifications.

About the newline, there are actually two paragraphes in the testdata, one is:

第一
行文字。

and the other is:

第
二
行文字。

So it should generate two lines:

<p>第一行文字。</p>

and

<p>第二行文字。</p>

Consecutive newline characters, for example two newlines, are used to separate two paragraphes and should not generate just one line (i.e. one paragraph).

If I don't get your idea, please forgive me. Or you can give me an example to illustrate.

@rtfb

This comment has been minimized.

Collaborator

rtfb commented Apr 13, 2017

Thanks, @choueric!

@rtfb rtfb merged commit b253417 into russross:master Apr 13, 2017

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details

anthonyfok added a commit to gohugoio/hugo that referenced this pull request Jun 27, 2017

helpers: Add Blackfriday 'joinLines' extension support (#3574)
See russross/blackfriday#334
"add an extension to handle Chinese (or CJK) newlines"
for more information.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment