7 with open(pathlib.Path(__file__).parent / 'config.json') as f:
8 CONFIGURATION = json.loads(f.read())
10 app = flask.Flask(__name__)
12 def render_markdown_file(name, title):
14 with open(pathlib.Path(CONFIGURATION['directory']) / '{}.md'.format(name), 'r') as f:
15 content = commonmark.commonmark(f.read())
16 except FileNotFoundError as e:
19 return flask.render_template('page.html', content=content, title=title)
23 return render_markdown_file('_index', 'Home')
25 @app.route('/p/<name>')
28 if not ch in 'abcdefghijklmnopqrstuvwxyz-0123456789':
31 return render_markdown_file(name, name.replace('-', ' ').title())