The sad state of markdown processors
eigenclass.org
eigenclass.org
The point of Markdown isn't to create a super-flexible text2html replacement. The point of Markdown is to come up with rules that match the way people write existing email/Usenet messages as closely as possible. Any time you add a semantic to the format --- like !-headers --- that are virtually never used in email or Usenet, you might as well go all the way off the reservation and implement Textile. I hear Textile does tables, too; I'm sure someone's got an implementation that will generate HTML FORM tags as well. Knock yourself out!
(Also, numbered lists are one of my pet peeves with Markdown, since renumbering lists sucks. His way seems more usable.)
In the past I've tried using Markdown for all my docs and failed. Sometimes you just need more control and must use something like LaTeX. Other times you just want to write a README or a few paragraphs that may be converted to html -- these uses are Markdown's bread and butter.
type paragraph =
Normal of par_text
| Pre of string * string option
| Heading of int * par_text
| Quote of paragraph list
| Ulist of paragraph list * paragraph list list
| Olist of paragraph list * paragraph list list
The type definition is stated almost the same as the grammar rule would be.It's a neat language. It's got some implementation and usability quirks, and it seems to have a rather small / quiet community (so there aren't many books, though this one is quite good, IMHO: http://caml.inria.fr/pub/docs/oreilly-book/ ), but it's worth a look.
I've actually that essay already about how OCaml is good for compilers, but it really struck me with this example.
For what it's worth, the OCaml version is a markup processor of the author's design, and not exactly Markdown-compatible. He argues that it's close enough for benchmarking purposes, though. (I agree.)