Re:Markdown Editor
by pors on Wednesday January 04, 2012 @12:55PM
(#3425083)
Shouldn't an <enter> become a <br/>? It currently doesn't. But cool little tool, starts up faster than dreamweaver :)
[ Parent
| on HN ]
Re:Markdown Editor
by RyanMcGreal on Wednesday January 04, 2012 @01:34PM
(#3425250)
In markdown, you need to precede the <enter> with two spaces to get a <br>.
As I understand it, Markdown syntax was inspired by email syntax, so we have > for block quotations, * for unordered list items, etc. By this reasoning, a single newline may just be the email client wrapping the text, whereas a double newline means the writer is starting a new paragraph.
Re:Markdown Editor
by gordonguthrie on Wednesday January 04, 2012 @05:29PM
(#3426226)
Markdown is pretty gnarly as a language. I wrote a markdown interpreter for Erlang https://github.com/hypernumbers/erlmarkdown
Initially I wrote it against the Daring Fireball spec but switched it over to track the output of the showdown javascript library.
Markdown is not a great language to implement. I wrote a hand parser because there are loads of places where you have to look ahead more than one token (not that I am a great lexer/parser expert).
In markdown single line endings are ignored when the lines broken by them might be construed as forming a single paragraph. (It's actually one of the fiddliest bits of markdown.)
This rule is quirky -- sometimes you'll end up with (for example) bullet points merged into a paragraph through this quirk.