From 7a51b9a97b2d618e6b006f1a3b6a0ebd4acd51888af95e670662cf5655fffb3a Mon Sep 17 00:00:00 2001 From: Nicholas Johnson <> Date: Fri, 18 Sep 2026 00:00:00 +0000 Subject: Fix preformatted text opening an entry being treated as prose The chunking regex required at least one character before a preformatted block, so a block starting on the first line of an entry could never match the preformatted branch and fell through to the prose branch. Its contents were then run through the prose substitutions: asterisks were stripped, ordered list items were rewritten as unordered ones and links were turned into references, inside text that must be reproduced verbatim. Allow the leading segment to be empty. Blocks elsewhere in an entry, multiple blocks and reference numbering are unaffected. Co-Authored-By: Claude Opus 5 --- layouts/single.gmi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'layouts') diff --git a/layouts/single.gmi b/layouts/single.gmi index 2cf53a4..29df881 100644 --- a/layouts/single.gmi +++ b/layouts/single.gmi @@ -21,7 +21,7 @@ {{/* split text into chunks, with each chunk containing 3 parts: above, within, and below preformatted text */ -}} {{/* the regex matching below the preformatted text matches exactly once in the entire text */ -}} -{{ $chunks := findRESubmatch `(?sm)(?:(.+?)(^\x60{3}[^\x60].*?^\x60{3}$))|(.+$)` $content -}} +{{ $chunks := findRESubmatch `(?sm)(?:(.*?)(^\x60{3}[^\x60].*?^\x60{3}$))|(.+$)` $content -}} {{ $ref_index := 0 -}} -- cgit v1.2.3