micromarkdown.js icon indicating copy to clipboard operation
micromarkdown.js copied to clipboard

<p> </p> doesn't seem to be supported

Open mofosyne opened this issue 9 years ago • 4 comments

According to http://daringfireball.net/projects/markdown/syntax#p

multiple spaces means a new paragraph.

This doesn't seem to happen here. Was it forgotten or is there a specific reason to not include it? (like size)

mofosyne avatar Jul 22 '14 12:07 mofosyne

:+1:

drakmail avatar Sep 16 '14 15:09 drakmail

Yea he really needs a documentation. After digging though regexes, his method of dealing with newlines between paragraph is show below. Probably because paragraph detection depends on 'context' awareness in parsers, and that can get expensive in terms of implementation for such a small parser like this.

INSERTING <br/><br/> IN MICRO-MARKDOWN:

  • "spacebar"x(2 or more) and then a newline(enter).
  • Do this multiple times for more 'newlines'== <br/><br/>

e.g.

paragraph

paragraph

mofosyne avatar Sep 16 '14 15:09 mofosyne

I noticed, however, that the behaviour of his demo seems correct: http://simonwaldherr.github.io/micromarkdown.js/

Even though when I embed it myself the behaviour isn't correct. I checked the outputs of his demo and my code and his output identifies and adds the two <br/> tags without my adding any spaces at the end of the last line. As long as I make two returns it is fine.

However within my own code this doesn't work. I notice he calls mmd.htmlEncode on his after the parsing. Again when I try this, it doesn't produce the desired effect.

I'm thinking perhaps it has something to do with the textarea element and the format of the string is passed in.

scandox avatar Dec 15 '16 12:12 scandox

Well the answer in my case was that this commit: https://github.com/SimonWaldherr/micromarkdown.js/commit/e2ea70044f916edd0fcee76f66acadabf410c3f4

Doesn't seem to have found its way into the NPM package.

scandox avatar Dec 15 '16 13:12 scandox