Converting newline into space makes sense for English, for example, the following HTML:
<p>
This is
a sentence.
</p>
We get the following after converting the newline into space in the browser:
This is a sentence.
This is good for English, but not good for Chinese characters because we don't use spaces to separate words in Chinese. Here's an example (The Chinese sentence has the same meaning of "This is a sentence"):
<p>
这是
一句话。
</p>
I get the following result on Chrome, Safari and IE...
这是 一句话。
...but what I wanted is the following, without the extra space:
这是一句话。
I don't know why the browser does not ignore the newline if the last character of the current line and the first character of the next line are both Chinese characters (which I think makes more sense). Or they have provided this mechanism but need special handling?
BTW, in Vim, when using "J" to join lines, no space will be added if the last and the first character of the 2 lines are all Chinese characters. But for English, a space will be added. So I guess Vim does some special handling for this.
UPDATE:
Though I think this is an issue with the browser, I have to live with that. So currently I would preprocess my Markdown text to join Chinese lines before generating HTML. Here's how I do this in Ruby, complete code which also handles Chinese punctuations is on gist
#encoding: UTF-8
# Requires ruby 1.9.x, and assume using UTF-8 encoding
class String
# The regular expression trick to match CJK characters comes from
# http://stackoverflow.com/a/4681577/306935
def join_chinese
gsub(/(\p{Han})\n(\p{Han})/m, '\1\2')
end
end