diff options
author | Nicholas Johnson <nick@nicholasjohnson.ch> | 2023-12-29 00:00:00 +0000 |
---|---|---|
committer | Nicholas Johnson <nick@nicholasjohnson.ch> | 2023-12-31 00:00:00 +0000 |
commit | 8c650e2a361500797fe7ab7f01b8544cad6431e23c8f76c1668546baa04cb7dc (patch) | |
tree | 04e6293ce60011f2eaaf45e2733df6057234b21ed6cdc5a8494a7031ed02245c /layouts/_default/single.gmi | |
parent | 77be90509f6d6a17e66aa755bb7a7e49d0227d845aa50e1e01128ac84bcff2d8 (diff) | |
download | hugo-theme-journal-8c650e2a361500797fe7ab7f01b8544cad6431e23c8f76c1668546baa04cb7dc.tar.gz hugo-theme-journal-8c650e2a361500797fe7ab7f01b8544cad6431e23c8f76c1668546baa04cb7dc.zip |
Add support for alternative heading syntaxv1.1.0
Diffstat (limited to 'layouts/_default/single.gmi')
-rw-r--r-- | layouts/_default/single.gmi | 4 |
1 files changed, 4 insertions, 0 deletions
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" -}} |