# I can see that automatically running all code blocks is not going to work.
# It seems more like selective running is in order.
#
#
#
#


if 1:
    with open('using_it.md') as fh:
        raw_md = fh.read()

    sp = raw_md.split('```')
    blocks = sp[1::2]
    for block in blocks:
        pprint(block)




if 0:
    with open('using_it.md') as fh:
        lines = fh.readlines()

    code_blocks = []
    from collections import defaultdict
    code_blocks = defaultdict(lambda:[])
    in_code_block = False
    for line in lines:
        if line.startswith('```'):
            in_code_block = not in_code_block
        if in_code_block and line.startswith('```'):
            name = line[3:-1]
            block = []
        if in_code_block:
            block.append(line)
        if not in_code_block:
            code_blocks[name].append(block)



