markdown support

This commit is contained in:
mi
2025-11-12 10:48:35 +10:00
parent 376333bb42
commit 4657d85dde
5 changed files with 38 additions and 25 deletions

11
app.py
View File

@@ -2,6 +2,7 @@ import os
from datetime import datetime
from flask import Flask, render_template, abort, jsonify, request
from comics_data import COMICS, FULL_WIDTH_DEFAULT, PLAIN_DEFAULT, HEADER_IMAGE, COMPACT_FOOTER
import markdown
app = Flask(__name__)
@@ -107,7 +108,15 @@ def archive():
@app.route('/about')
def about():
"""About page"""
return render_template('about.html', title='About')
# Read and render the markdown file
about_path = os.path.join(os.path.dirname(__file__), 'content', 'about.md')
try:
with open(about_path, 'r', encoding='utf-8') as f:
content = f.read()
html_content = markdown.markdown(content)
except FileNotFoundError:
html_content = '<p>About content not found.</p>'
return render_template('page.html', title='About', content=html_content)
@app.route('/api/comics')