From 8c650e2a361500797fe7ab7f01b8544cad6431e23c8f76c1668546baa04cb7dc Mon Sep 17 00:00:00 2001 From: Nicholas Johnson Date: Fri, 29 Dec 2023 00:00:00 +0000 Subject: Add support for alternative heading syntax --- layouts/_default/single.gmi | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'layouts/_default') diff --git a/layouts/_default/single.gmi b/layouts/_default/single.gmi index 93c1439..e6d6fdf 100644 --- a/layouts/_default/single.gmi +++ b/layouts/_default/single.gmi @@ -68,6 +68,10 @@ {{/* trim extra heading symbols */ -}} {{ $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" -}} + {{ $rendered_text = $rendered_text | replaceRE `(?m)^[\t ]*(\S.+?)[\t ]*\n\-+$` "## $1" -}} + {{/* remove bold and italics asterisk symbols */ -}} {{ $rendered_text = $rendered_text | replaceRE `\*{3}(\S|\S.*?\S)\*{3}` "$1" -}} {{ $rendered_text = $rendered_text | replaceRE `\*{2}(\S|\S.*?\S)\*{2}` "$1" -}} -- cgit v1.2.3