from fastapi import FastAPI, Request from fastapi.staticfiles import StaticFiles from fastapi.responses import HTMLResponse from fastapi.templating import Jinja2Templates import json import os from starlette.middleware.httpsredirect import HTTPSRedirectMiddleware app = FastAPI() # Mount static files app.mount("/static", StaticFiles(directory="static"), name="static") app.add_middleware( HTTPSRedirectMiddleware ) # Templates directory templates = Jinja2Templates(directory="templates") # Load JSON data with open("mock_data.json") as file: data = json.load(file) @app.get("/test", response_class=HTMLResponse) async def mark_test(): markdown_content = """ # Custom Tags Test Here is an image overlay: {img-left-overlay: src=my-cat.png} Here is a box: {box: title=Important, content=This is a reusable box.} And a note: {note: content=This is a note for the user.} Warning section: {warning: content=Pay attention to this warning!} """ # Render Markdown content rendered_html = md_renderer.render( markdown_content ) # Wrap in a basic template template = f"""