evilstreak / markdown-js

A Markdown parser for javascript
7.69k stars 863 forks source link

multiple paragraphs should not be placed in one single p tag #194

Closed meetwudi closed 10 years ago

meetwudi commented 10 years ago

If I have two conjoint paragraphs in a markdown file, and I convert it to html using md2html, they will be put in a single p tag, which is not supposed to be like this. They should be in separate p tag.

evilstreak commented 10 years ago

Can you provide an example?

meetwudi commented 10 years ago

Just like this:

Hey, this is paragraph1.[space][space]  
Well, this is paragraph2.

This is converted to

<p>
Hey, this is paragraph1. <br>
Well, this is paragraph2.
</p>

But it is supposed to be

<p>
Hey, this is paragraph1.
</p>
<p>
Well, this is paragraph2.
</p>
evilstreak commented 10 years ago

That's correct behaviour. Almost every implementation including the original turns that input into one paragraph with a br after the first line: http://johnmacfarlane.net/babelmark2/?normalize=1&text=Hey%2C+this+is+paragraph1.++%0AWell%2C+this+is+paragraph2.

meetwudi commented 10 years ago

But this is absolutely not convenient for styling, I think it is necessary to offer an option to switch between p and br.

evilstreak commented 10 years ago

If you want two paragraphs you need to have a blank line between them:

Hey, this is paragraph1.

Well, this is paragraph2.
meetwudi commented 10 years ago

This does not work, if I add the blank line, it simply missed the br tag.