From 59066559020f207aa4315ea6f19013e376339b64 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A2u=20Cao?= Date: Mon, 28 Oct 2024 12:36:15 +0100 Subject: [PATCH] Format inline code blocks in article titles --- html.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/html.ts b/html.ts index 39602e2..c5a7818 100644 --- a/html.ts +++ b/html.ts @@ -53,7 +53,7 @@ export async function articleHtml(
${draftLabel} -

${article.title}

+

${titleHtml(article.title)}

User Avatar
@@ -77,12 +77,16 @@ export async function articleHtml( return htmlLayout({ title: pageTitle, body, metaHtml }); } +function titleHtml(title: string) { + return title.replace(/`([^`]+)`/g, "$1"); +} + function articleListItemHtml(article: Article): string { const formattedDate = localizeDate(article.publishedAt); return `