From 760689a40925e3f8445310fd5410e8e56265d409a071f25f2db253721f84c982 Mon Sep 17 00:00:00 2001 From: Nicholas Johnson Date: Thu, 2 May 2024 00:00:00 +0000 Subject: Correct heading regex --- layouts/_default/single.gmi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'layouts') diff --git a/layouts/_default/single.gmi b/layouts/_default/single.gmi index d9da38d..f00b1d1 100644 --- a/layouts/_default/single.gmi +++ b/layouts/_default/single.gmi @@ -14,7 +14,7 @@ {{ $scratch := newScratch -}} {{/* if content begins with a heading, add an extra space */ -}} -{{ if (findRE `(?)^#{1,3}` $content) }} +{{ if (findRE `^#{1,6} ` $content 1) }} {{ end -}} {{/* split text into chunks, with each chunk containing 3 parts: above, within, and below preformatted text */ -}} @@ -66,7 +66,7 @@ {{ end -}} {{/* trim extra heading symbols */ -}} - {{ $rendered_text = $rendered_text | replaceRE `(?m)^####{1,3}` "###" -}} + {{ $rendered_text = $rendered_text | replaceRE `(?m)^####{1,3} ` "### " -}} {{/* convert alternative heading syntax to number signs */ -}} {{ $rendered_text = $rendered_text | replaceRE `(?m)^[\t ]*(\S.+?)[\t ]*\n\=+$` "# $1" -}} -- cgit v1.2.3