mnemonic-fastapi/app/library/helpers.py (11 lines of code) (raw):

import os.path import markdown def openfile(filename): filepath = os.path.join("app/pages/", filename) with open(filepath, "r", encoding="utf-8") as input_file: text = input_file.read() html = markdown.markdown(text) data = { "text": html } return data