From 4198ceb4b34201452a345b29401cb5b852ca322c Mon Sep 17 00:00:00 2001 From: Joe Carstairs Date: Mon, 13 Apr 2026 09:40:48 +0100 Subject: [PATCH] merge adjacent blockquotes when transforming gemtext -> HTML --- website/src/pages/blog/[...slug].astro | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/website/src/pages/blog/[...slug].astro b/website/src/pages/blog/[...slug].astro index 4fe82c2..86cdcfe 100644 --- a/website/src/pages/blog/[...slug].astro +++ b/website/src/pages/blog/[...slug].astro @@ -52,9 +52,18 @@ const GemtextHTMLRenderer: Gemtext.Renderer = { } }; +function postProcessGemtextToHtml(html: string): string { + html = mergeAdjacentBlockquotes(html); + return html; +} + +function mergeAdjacentBlockquotes(html: string): string { + return html.replaceAll(/\<\/blockquote\>\/gm, '
'); +} + const post = Astro.props; const Content = post.filePath?.endsWith('.gmi') - ? Gemtext.parse((post.body ?? '').replace(`# ${post.data.title}`, '')).generate(GemtextHTMLRenderer) + ? postProcessGemtextToHtml(Gemtext.parse((post.body ?? '').replace(`# ${post.data.title}`, '')).generate(GemtextHTMLRenderer)) : (await render(post)).Content; ---