diff options
author | Nicholas Johnson <nick@nicholasjohnson.ch> | 2023-05-05 00:00:00 +0000 |
---|---|---|
committer | Nicholas Johnson <nick@nicholasjohnson.ch> | 2023-05-05 00:00:00 +0000 |
commit | 960ec4f55d294c01621fc3b8b7b752d6a70c3614e54b75400633ef7bfdce46b1 (patch) | |
tree | e8205a3f11c25a68e05ce170ed1650e59cebc2c1bd13f83594c5a8055f7eee2a /layouts/_default/single.gmi | |
parent | 4fe1d5738fa41e5a8fe0d7270c049690991961cd165e0a4f0fcc3139ebc3d07b (diff) | |
download | hugo-theme-journal-960ec4f55d294c01621fc3b8b7b752d6a70c3614e54b75400633ef7bfdce46b1.tar.gz hugo-theme-journal-960ec4f55d294c01621fc3b8b7b752d6a70c3614e54b75400633ef7bfdce46b1.zip |
Allow whitespace in Markdown links
Diffstat (limited to 'layouts/_default/single.gmi')
-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 38a2a8c..ff4af95 100644 --- a/layouts/_default/single.gmi +++ b/layouts/_default/single.gmi @@ -20,7 +20,7 @@ {{- $rendered_text := print $before_pre $after_pre }} {{- if ($.Page.Params.makerefs | default true) }} - {{- $chunk_refs := findRESubmatch `!?\[(.+?)\]\((.+?)(?:\s+"(.+?)")?\)` $rendered_text }} + {{- $chunk_refs := findRESubmatch `!?\[\s*(.+?)\s*\]\(\s*(.+?)(?:\s+"(.+?)")?\s*\)` $rendered_text }} {{- $scratch.Add "refs" $chunk_refs }} {{- range $chunk_refs }} {{- $ref_index = add $ref_index 1 }} @@ -28,7 +28,7 @@ {{- $rendered_text = replace $rendered_text (index . 0) (print $ref_text "[" $ref_index "]") 1 }} {{- end }} {{- else }} - {{- $rendered_text = $rendered_text | replaceRE `(?m)^!?\[(.+?)\]\((.+?)(?:\s+"(.+?)")?\)$` (print "=> $2 " $emoji "$1") }} + {{- $rendered_text = $rendered_text | replaceRE `(?m)^!?\[\s*(.+?)\s*\]\(\s*(.+?)(?:\s+"(.+?)")?\s*\)$` (print "=> $2 " $emoji "$1") }} {{- end }} {{- $rendered_text = $rendered_text | replaceRE `(?m)^####{1,3}` "###" }} {{- $rendered_text = $rendered_text | replaceRE `\*{3}(\S|\S.*?\S)\*{3}` "$1" }} |