aboutsummaryrefslogtreecommitdiff
path: root/layouts/_default
diff options
context:
space:
mode:
authorNicholas Johnson <nick@nicholasjohnson.ch>2024-05-20 00:00:00 +0000
committerNicholas Johnson <nick@nicholasjohnson.ch>2024-05-20 00:00:00 +0000
commita9b232e3fc3431ae4d5f75b00c2415f471ff5c9f48979655889a145291b8665b (patch)
treecfe4c5bab1c968748ba17038d6d0444c438db7d041dd71bcd8112c2e2a3e1d8d /layouts/_default
parenta8bda0a1554b3255c67ea39c609532ae87f7105cde5d854d0b52e175484b0b1a (diff)
downloadhugo-theme-journal-a9b232e3fc3431ae4d5f75b00c2415f471ff5c9f48979655889a145291b8665b.tar.gz
hugo-theme-journal-a9b232e3fc3431ae4d5f75b00c2415f471ff5c9f48979655889a145291b8665b.zip
Fix Gemini incorrectly rendering (un)ordered lists
Diffstat (limited to 'layouts/_default')
-rw-r--r--layouts/_default/single.gmi13
1 files changed, 7 insertions, 6 deletions
diff --git a/layouts/_default/single.gmi b/layouts/_default/single.gmi
index b871d67..c6b7356 100644
--- a/layouts/_default/single.gmi
+++ b/layouts/_default/single.gmi
@@ -72,18 +72,19 @@
{{ $rendered_text = $rendered_text | replaceRE `(?m)^[\t ]*(\S.+?)[\t ]*\n\=+$` "# $1" -}}
{{ $rendered_text = $rendered_text | replaceRE `(?m)^[\t ]*(\S.+?)[\t ]*\n\-+$` "## $1" -}}
- {{/* remove bold and italics asterisk symbols */ -}}
- {{/* note: this operation is performed in 3 steps to handle nested bold and italics */ -}}
- {{ $rendered_text = $rendered_text | replaceRE `\*{3}(\S(?:.*\S)?)\*{3}` "$1" -}}
- {{ $rendered_text = $rendered_text | replaceRE `\*{2}(\S(?:.*\S)?)\*{2}` "$1" -}}
- {{ $rendered_text = $rendered_text | replaceRE `\*{1}(\S(?:.*\S)?)\*{1}` "$1" -}}
-
{{/* convert Markdown alternative unordered list syntax to gemtext unordered list syntax */ -}}
{{ $rendered_text = $rendered_text | replaceRE `(?m)^[-+] ` "* " -}}
{{/* convert Markdown ordered list items to gemtext unordered list items */ -}}
{{ $rendered_text = $rendered_text | replaceRE `(?m)^[1-9]\d*\.[\t ]+(.*?)[\t ]*$` "* $1" -}}
+ {{/* remove bold and italics asterisk symbols */ -}}
+ {{/* note: this operation is performed in 3 steps to handle nested bold and italics */ -}}
+ {{/* note: this operation is performed last to avoid incorrectly rendering (un)ordered lists */ -}}
+ {{ $rendered_text = $rendered_text | replaceRE `\*{3}(\S(?:.*\S)?)\*{3}` "$1" -}}
+ {{ $rendered_text = $rendered_text | replaceRE `\*{2}(\S(?:.*\S)?)\*{2}` "$1" -}}
+ {{ $rendered_text = $rendered_text | replaceRE `\*{1}(\S(?:.*\S)?)\*{1}` "$1" -}}
+
{{ $rendered_text = $rendered_text | emojify -}}
{{/* demux regex matches above and below preformatted text */ -}}