import { render as renderMarkdown } from "@deno/gfm"; import { log } from "./log.ts"; export function htmlLayout(title: string, body: string) { return ` ${title} ${body} `; } export function articleHtml(articleEvent: object, profile: object) { const titleTag = articleEvent.tags.find(t => t[0] === "title"); const title = titleTag ? titleTag[1] : "Untitled"; const content = renderMarkdown(articleEvent.content); const date = new Date(articleEvent.created_at * 1000); const formattedDate = date.toLocaleDateString("en-US", { year: "numeric", month: "long", day: "numeric", }); const body = `

${title}

User Avatar ${profile.name} ${formattedDate}

${content}
`; return htmlLayout(title, body); }