I ended up writing run-markdown yesterday. A utility that lets you run code in a markdown file.

Check it out here:

https://github.com/carlwoodward/run-markdown