« So, my family is basically homeless. Until Tuesday. | Main | Guitar Hero 5: Thoughts from an actual guitarist »
Tuesday
Aug182009

Bug found in Markdown?

I seem to have found a bug in Markdown (the syntax and conversion tool for web writing). In a nutshell, it looks as though paragraph spacing in lists causes a side effect in which two adjacent lists will be “merged” together. I was trying to use something like this:
- First unordered item
- Second unordered item
- Third unordered item

1. First ordered item
2. Second ordered item
3. Third ordered item

Unfortunately, when converted to HTML, this becomes one big list:

  • First unordered item

  • Second unordered item

  • Third unordered item

  • First ordered item

  • Second ordered item

  • Third ordered item


Workaround


Inserting some text between the paragraphs seems to be the easiest way around this:
- First unordered item
- Second unordered item
- Third unordered item

Breaker breaker one nine

1. First ordered item
2. Second ordered item
3. Third ordered item

Here’s the HTML:

  • First unordered item

  • Second unordered item

  • Third unordered item


Breaker breaker one nine

  1. First ordered item

  2. Second ordered item

  3. Third ordered item


Theory


This seems to be a side effect of the syntax feature that allows paragraph spacing in lists. Here’s a quick example:

List without spacing:
*   Bird
* Magic

HTML:

  • Bird

  • Magic


List with spacing:
*   Bird

* Magic

HTML:

  • Bird

  • Magic


That example, taken from the John Gruber's online documentation, makes perfect sense. Here’s that example again, tweaked a bit to show the issue:

List with spacing:
*   Alex Rodriguez

* Derek Jeter

* CC Sabathia (note the double-spacing)



* J.D. Drew

* David Ortiz

* Mike Lowell

HTML:

  • Alex Rodriguez

  • Derek Jeter

  • CC Sabathia (note the double-spacing)

  • J.D. Drew

  • David Ortiz

  • Mike Lowell


For obvious reasons, the last three entries have no business being associated with the first three. You can download this post in Markdown format to experiment on your own. Can anyone think of a clean way around this?

Reader Comments

There are no comments for this journal entry. To create a new comment, use the form below.

PostPost a New Comment

Enter your information below to add a new comment.
Author Email (optional):
Author URL (optional):
Post:
 
All HTML will be escaped. Textile formatting is allowed.