feat: stylised pdf

This commit is contained in:
Timothy J. Baek 2024-04-03 20:35:32 -07:00
parent bfd066cc2f
commit 1f85354856
3 changed files with 78 additions and 4 deletions

View file

@ -5,6 +5,8 @@ from starlette.responses import StreamingResponse, FileResponse
from pydantic import BaseModel
import markdown
import requests
import os
import aiohttp
@ -28,6 +30,17 @@ async def get_gravatar(
return get_gravatar_url(email)
class MarkdownForm(BaseModel):
md: str
@router.post("/markdown")
async def get_html_from_markdown(
form_data: MarkdownForm,
):
return {"html": markdown.markdown(form_data.md)}
@router.get("/db/download")
async def download_db(user=Depends(get_admin_user)):