From 28b1d565836f56893413172ecb9228bd1cc4a531c702d47275e98bdb0433e125 Mon Sep 17 00:00:00 2001 From: Nicholas Johnson Date: Thu, 2 May 2024 00:00:00 +0000 Subject: Don't match newlines in link regex --- layouts/_default/single.gmi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/layouts/_default/single.gmi b/layouts/_default/single.gmi index 5671a23..d9da38d 100644 --- a/layouts/_default/single.gmi +++ b/layouts/_default/single.gmi @@ -34,7 +34,7 @@ {{ if ($.Page.Params.makerefs | default true) -}} {{/* find all the links within a chunk */ -}} - {{ $chunk_refs := findRESubmatch `!?\[\s*(.+?)\s*\]\(\s*(.+?)(?:\s+"(.+?)")?\s*\)` $rendered_text -}} + {{ $chunk_refs := findRESubmatch `!?\[[\t ]*(.+?)[\t ]*\]\([\t ]*(.+?)(?:[\t ]+"(.+?)")?[\t ]*\)` $rendered_text -}} {{ $scratch.Add "refs" $chunk_refs -}} {{ range $chunk_refs -}} @@ -61,7 +61,7 @@ {{ else -}} {{/* render all links directly */ -}} - {{ $rendered_text = $rendered_text | replaceRE `(?m)^!?\[\s*(.+?)\s*\]\(\s*(.+?)(?:\s+"(.+?)")?\s*\)$` (print "=> $2 " $emoji "$1") -}} + {{ $rendered_text = $rendered_text | replaceRE `(?m)^!?\[[\t ]*(.+?)[\t ]*\]\([\t ]*(.+?)(?:[\t ]+"(.+?)")?[\t ]*\)$` (print "=> $2 " $emoji "$1") -}} {{ end -}} -- cgit v1.2.3