When you're writing a Markdown editor, you have to be worried about Markdown formatting in two distinct, and not always especially related, ways.

The first is that you have to format the Markdown into html markup correctly. That's a no-brainer requirement, and there are plenty of libraries to help you convert raw Markdown to html. That said, there are extensions to Markdown that sometimes require quite a bit more discussion than you'd expect. If your favorite Markdown parsing library doesn't include these extensions, do you write them yourself? Change parsers? Etc, etc. Typical library evaluation stuff.

The second consideration, however, is how you make your users' Markdown input more graceful.

Take the following example. Say I've got this text...

I was reading the following snippet on Mozillazine.org about the history of replying about and below quoted emails:|

... and I have the cursor exactly at the "pipe" character -- | -- what should happen if I pasted in my clipboard's contents as a quotation (Ctrl-Shift-V in my editor)?

There are a number of choices. The pasted quotation could read...

I was reading the following snippet on [Mozillazine.org](http://kb.mozillazine.org/Reply_above_quoted_message) 
about the history of replying about and below quoted emails:
> Traditional netiquette (especially on Usenet and mailing lists) is to reply contextually beneath quoted material, trimming down the quotes to the minimum needed to establish context. Also known as inline, interspersed and interleaved posting, this does not always put your entire reply beneath all of the quoted material, because if you are replying to multiple paragraphs, each section of the reply would be beneath the quote of the paragraph to which it is responding. Some people prefer to start their cursor at the top of the message in order to facilitate moving down through the message and trimming the quotes before typing replies contextually.|

Or they might prefer another newline before the quote so that you had the quoted material nicely set off...

I was reading the following snippet on [Mozillazine.org](http://kb.mozillazine.org/Reply_above_quoted_message) 
about the history of replying about and below quoted emails:

> Traditional netiquette (especially on Usenet and mailing lists) is to reply contextually beneath quoted material, trimming down the quotes to the minimum needed to establish context. Also known as inline, interspersed and interleaved posting, this does not always put your entire reply beneath all of the quoted material, because if you are replying to multiple paragraphs, each section of the reply would be beneath the quote of the paragraph to which it is responding. Some people prefer to start their cursor at the top of the message in order to facilitate moving down through the message and trimming the quotes before typing replies contextually.|

Or they might like to have that quote wrapped so that it's not one giant ugly line with a single greater than (>) in front of it [1]...

I was reading the following snippet on 
[Mozillazine.org](http://kb.mozillazine.org/Reply_above_quoted_message) 
about the history of replying about and below quoted emails:  

> Traditional netiquette (especially on Usenet and mailing lists) is to 
> reply contextually beneath quoted material, trimming down the quotes to 
> the minimum needed to establish context. Also known as inline, 
> interspersed and interleaved posting, this does not always put your 
> entire reply beneath all of the quoted material, because if you are 
> replying to multiple paragraphs, each section of the reply would be 
> beneath the quote of the paragraph to which it is responding. Some 
> people prefer to start their cursor at the top of the message in order 
> to facilitate moving down through the message and trimming the quotes 
> before typing replies contextually.|

(Or they might like wrapping but only one newline (so no full empty lines) between the quote setup and the quote itself...)

Curiously, those all render to the same html (which I'm setting off with an extra blockquote, below)...

I was reading the following snippet on Mozillazine.org about the history of replying about and below quoted emails:

Traditional netiquette (especially on Usenet and mailing lists) is to reply contextually beneath quoted material, trimming down the quotes to the minimum needed to establish context. Also known as inline, interspersed and interleaved posting, this does not always put your entire reply beneath all of the quoted material, because if you are replying to multiple paragraphs, each section of the reply would be beneath the quote of the paragraph to which it is responding. Some people prefer to start their cursor at the top of the message in order to facilitate moving down through the message and trimming the quotes before typing replies contextually.|

When you're trying to minimize application preferences, you really really want one of these options to be the a priori best.[2] Because otherwise you're selecting one for all of your users and knowing everyone who prefers another option enough to notice is going to, if you're lucky, let you know about it.


[1] To the point someone might've written an insanely ugly app to do just that for text-unfriendly Outlook.
[2] And if you're paying attention, yes, once you embed your Markdown editor into an email client, you have to worry about where you put the quoted material too. Argh. Fun times. Remember -- Just Fn Ship, see how much purchase you get, and then head back to add preferences where users actually have a strong enough reaction to your choice that adding a preferences item is The Right Thing to do. Just too bad that I'm wired to spend so much time sweating which selection is correct for the mvp.

Labels: , , , , ,