opening it up with Common Lisp

Favorite weblogs

Lisp Related

Bill Clementson

Finding Lisp


Planet Lisp



Talking Points Memo

This Modern World

Working for Change

Other home


Recent Readings

Book review: Darwinia
Reviewed: Friday, August 11, 2006

Summer reading: Spin
Reviewed: Saturday, August 5, 2006

Reviewed: Tuesday, July 18, 2006

the Omnivoire's Delimma
Reviewed: Wednesday, July 12, 2006

the Golem's Eye
Reviewed: Wednesday, May 31, 2006


CL-Markdown stumbles forward
Wednesday, May 3, 2006

I received two e-mails asking about CL-Markdown's status over the weekend. Aside from the Interactive Markdown Dingus (live site), I haven't done anything Markdown related since January. It's one of the many projects I want to finish but can't always find much time on which to work...

That said, I brushed off the code on Monday and tried to remember what my plans had been. I known that I started by looking at the Perl and Python sources but soon decided that it all seemed easier that that (famous last words, I know). I went with the following plan:

  • Read in the paragraphs of text while doing basic encoding (i.e., it is a header? Is it part of a list, etc.). This gives us a list of chunks.
  • Iterate over the chunks and handle various span related bits and pieces (i.e., looking for emphasis, links and the link).
  • Output the list with a spiffy recursive function that knows when to add depth to the tree being constructed.

The first two steps of this went quite well (though there is the added complication of stripping off the starts of lines depending on the current context. I.e., If we in a blockquote already, then we to pull off the initial '>'). The last step turned out to be surprisingly hard for me to quite grok and was the main reason development came to a halt in January.

Things still seemed harder than they should have -- I must not quite understand the problem! -- this time around, but after some thrashing, I developed the function I wanted and much is mostly well. I'm still not sure if my original theory (start and list and create the tree later was flawed or if I'm just being stupid about the list to tree conversion... Sometimes it's hard to tell.)

There are still a few features completely unimplemented (e.g., special character escaping) and lots and lots of glitches. I wrote a program that compares the output of regular markdown and CL-Markdown using John Wiseman's CL-HTML-Diff. I'll get some good and bad examples up later tonight.

I'll also be throwing the code up to in the near future so that everyone can find ways to break it!


Home | About | Quotes | Recent | Archives

Copyright -- Gary Warren King, 2004 - 2006