summaryrefslogtreecommitdiff
path: root/website
diff options
context:
space:
mode:
authorJoe Carstairs <me@joeac.net>2026-04-13 09:40:48 +0100
committerJoe Carstairs <me@joeac.net>2026-04-13 09:40:48 +0100
commit4198ceb4b34201452a345b29401cb5b852ca322c (patch)
tree74e4be7db2a1e56ef07562b01dd08e555f42864d /website
parentef451a063b0045da39fa5f655b4ba5fa5e2f09e8 (diff)
merge adjacent blockquotes when transforming gemtext -> HTML
Diffstat (limited to 'website')
-rw-r--r--website/src/pages/blog/[...slug].astro11
1 files changed, 10 insertions, 1 deletions
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<string> = {
}
};
+function postProcessGemtextToHtml(html: string): string {
+ html = mergeAdjacentBlockquotes(html);
+ return html;
+}
+
+function mergeAdjacentBlockquotes(html: string): string {
+ return html.replaceAll(/\<\/blockquote\>\<blockquote\>/gm, '<br>');
+}
+
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;
---