diff options
author | Nicholas Johnson <nick@nicholasjohnson.ch> | 2024-04-30 00:00:00 +0000 |
---|---|---|
committer | Nicholas Johnson <nick@nicholasjohnson.ch> | 2024-04-30 00:00:00 +0000 |
commit | e13d11d7900e63f504fc3aed93f9eac9192d55a691f1610fe6d3268673d8d57a (patch) | |
tree | 6664ff25a238f3be379e997186c08d64d4e1634d3462d70384415123e8bdaa68 | |
parent | 60fb71b8af9f2b7f555ac5db8b8f9e27d8fcbb5523bee5a2bce3f5d1a7c8bcf2 (diff) |
Trim extra whitespace within gemtext elements
For efficiency, the regex for trimming extra whitespace within headings,
quotes, and unordered list items takes over the job of trimming extra
number signs within headings.
-rw-r--r-- | layouts/_default/single.gmi | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/layouts/_default/single.gmi b/layouts/_default/single.gmi index 6859925..4bba03c 100644 --- a/layouts/_default/single.gmi +++ b/layouts/_default/single.gmi @@ -65,8 +65,8 @@ {{ end -}} - {{/* trim extra number signs in headings */ -}} - {{ $rendered_text = $rendered_text | replaceRE `(?m)^####{1,3} ` "### " -}} + {{/* trim extra symbols in headings, quotes, and unordered list items */ -}} + {{ $rendered_text = $rendered_text | replaceRE `(?m)^(?:(#{1,3})#{0,3}?|(>|\*))[\t ]+(\S?.*?)[\t ]*?$` "$1$2 $3" -}} {{/* convert alternative heading syntax to number signs */ -}} {{ $rendered_text = $rendered_text | replaceRE `(?m)^[\t ]*(\S.+?)[\t ]*\n\=+$` "# $1" -}} |