Parable: Sources in Markdown
The Allegory interface for Parable now supports using Markdown for source code. This has some nice benefits for documenting things. It extracts code from two approaches: anything indented with four or more spaces and anything between fences (a series of 4 backticks, e.g, ````). This is supported at the command line, when including a file, and with libraries.
For interface implementers, here's the initial routine to grab the source lines from a Markdown file:
def extractFromMarkdown(name): v =  with open(name) as f: v = f.readlines() s =  fence = False for l in v: if l.startswith(' '): s.append(l[4:]) elif fence == True and l != '````\n': s.append(l) elif l == '````\n' and fence == True: fence = False elif l == '````\n' and fence == False: fence = True return s
I'm strongly considering adding this to other implementations supporting loading code from a file; the ability to mix code and documentation is really pretty nice, and worth the slightly more complex loading process.