From 7915354328889e53fcd1ef111876c3d0ad2c2afe Mon Sep 17 00:00:00 2001 From: Xevion Date: Sun, 11 Aug 2019 15:20:13 -0500 Subject: [PATCH] markdown rendering --- app/routes.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/routes.py b/app/routes.py index 38fe0d7..79a86f2 100644 --- a/app/routes.py +++ b/app/routes.py @@ -8,6 +8,7 @@ from flask_login import current_user, login_user, logout_user, login_required from io import BytesIO from textwrap import wrap from PIL import Image, ImageDraw, ImageFont +import mistune import requests import xmltodict import base64 @@ -20,16 +21,17 @@ import os print = pprint.PrettyPrinter().pprint fake = faker.Faker() +markdown = mistune.Markdown() strgen = lambda length, charset=string.ascii_letters, weights=None : ''.join(random.choices(list(charset), k=length, weights=weights)) @app.route('/modpacks') def modpacks(): - return open(os.path.join(app.root_path, 'static', 'MODPACKS.MD'), 'r').read() + return markdown(open(os.path.join(app.root_path, 'static', 'MODPACKS.MD'), 'r').read()) @app.route('/favicon.ico') def favicon(): - return send_from_directory(os.path.join(app.root_path, 'static', 'favicon.ico'), mimetype='image/vnd.microsoft.icon') + return send_from_directory(os.path.join(app.root_path, 'static'), 'favicon.ico', mimetype='image/vnd.microsoft.icon') @app.errorhandler(401) def unauthorized(e):