Files
blog/app/__init__.py
2026-03-04 18:00:42 -06:00

24 lines
569 B
Python

from flask import Flask
from app import build
from pathlib import Path
import markdown
app = Flask(__name__)
CONTENT_DIR = Path("/content")
@app.route("/")
def index():
# Write your markdown content
md_content = "# Welcome to my blog!\nThis is rendered from **Markdown**.\n##[test](http://localhost/test)"
# Convert it to HTML
html_content = markdown.markdown(md_content)
return html_content
@app.route ("/<filename>")
def render_post(filename):
return build.render_file(filename, CONTENT_DIR)
# return "test"
# return rm(filename)