import sys import markdown #filename = './source/Thun.md' filename = sys.argv[-1] with open(filename, encoding="UTF_8") as f: text = f.read() def title_of(html): return html[html.find('

') + 4:html.find('

')] #title = title_of(text) html = markdown.markdown(text, output_format="html5") rel = '../' if 'notebooks' in filename else '' print(f'''\ {title_of(html)}
{html} ''')