Yes! Here's a few thoughts I had on this a while ago http://jdanielsmith.org/DML.

This whole idea is also in-line with what Knuth proposed a long time ago with "Literate Programming", see http://sunburn.stanford.edu/~knuth/cweb.html