✨ markdown support
This commit is contained in:
11
app.py
11
app.py
@@ -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')
|
||||
|
||||
Reference in New Issue
Block a user