aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicholas Johnson <nick@nicholasjohnson.ch>2024-05-02 00:00:00 +0000
committerNicholas Johnson <nick@nicholasjohnson.ch>2024-05-02 00:00:00 +0000
commit760689a40925e3f8445310fd5410e8e56265d409a071f25f2db253721f84c982 (patch)
treeb5e5af1ad6eb681f1b77898a50acec0a0b30328620b9ed02373c228b49a30437
parent28b1d565836f56893413172ecb9228bd1cc4a531c702d47275e98bdb0433e125 (diff)
downloadhugo-theme-journal-760689a40925e3f8445310fd5410e8e56265d409a071f25f2db253721f84c982.tar.gz
hugo-theme-journal-760689a40925e3f8445310fd5410e8e56265d409a071f25f2db253721f84c982.zip
Correct heading regex
-rw-r--r--layouts/_default/single.gmi4
1 files changed, 2 insertions, 2 deletions
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" -}}