Demo
Note that Marked's lexer makes it easy to extract code blocks from markdown files:
# codeFrom = (source) ->
# (t.text for t in marked.lexer(source) when t.type == 'code').join "\n"
Hence, it's not hard to use this to extract and run, say, python code blocks.
print "hello world!"
A bit more.
from collections import defaultdict as dd
def autodict(): return dd(autodict)
d = autodict()
d['an']['arbitrarily']['deep']['dictionary'] = "yes!"
print d['an']['arbitrarily']['deep']['dictionary']
To dump to a file: marko.coffee -x try.python.md > try.py
To extract and run: marko.coffee -x try.python.md | python -s