aboutsummaryrefslogtreecommitdiff
path: root/layouts
diff options
context:
space:
mode:
authorNicholas Johnson <nick@nicholasjohnson.ch>2023-05-05 00:00:00 +0000
committerNicholas Johnson <nick@nicholasjohnson.ch>2023-05-05 00:00:00 +0000
commit5a66837521d1d66a6df1cfbe9d9a89efc1eeb4f15834e941835350a8494b4012 (patch)
treef696497acb0eead6cbb1be8d2c98ea1c3b74f214b1ccb9363ab7dde2db85b3b8 /layouts
parentc0830ef2a8289747eebb1f662fdad390dfee3491d62eddb0176047998949b668 (diff)
downloadhugo-theme-journal-5a66837521d1d66a6df1cfbe9d9a89efc1eeb4f15834e941835350a8494b4012.tar.gz
hugo-theme-journal-5a66837521d1d66a6df1cfbe9d9a89efc1eeb4f15834e941835350a8494b4012.zip
Add inline image support for HTML
Diffstat (limited to 'layouts')
-rw-r--r--layouts/_default/single.gmi10
1 files changed, 5 insertions, 5 deletions
diff --git a/layouts/_default/single.gmi b/layouts/_default/single.gmi
index c24c424..4e6f302 100644
--- a/layouts/_default/single.gmi
+++ b/layouts/_default/single.gmi
@@ -19,16 +19,16 @@
{{- $rendered_text := print $before_pre $after_pre }}
- {{- $chunk_refs := findRE `\[.+?\]\(.+?\)` $rendered_text }}
+ {{- $chunk_refs := findRE `!?\[.+?\]\(.+?\)` $rendered_text }}
{{- $scratch.Add "refs" $chunk_refs }}
{{- if ($.Page.Params.makerefs | default true) }}
{{- range $chunk_refs }}
{{- $ref_index = add $ref_index 1 }}
- {{- $ref_text := replaceRE `\[(.+?)\]\((.+?)\)` "$1" . 1 }}
+ {{- $ref_text := replaceRE `!?\[(.+?)\]\((.+?)\)` "$1" . 1 }}
{{- $rendered_text = replace $rendered_text . (print $ref_text "[" $ref_index "]") 1 }}
{{- end }}
{{- else }}
- {{- $rendered_text = $rendered_text | replaceRE `(?m)^\[(.+?)\]\((.+?)\)$` (print "=> $2 " $emoji "$1") }}
+ {{- $rendered_text = $rendered_text | replaceRE `(?m)^!?\[(.+?)\]\((.+?)\)$` (print "=> $2 " $emoji "$1") }}
{{- end }}
{{- $rendered_text = $rendered_text | replaceRE `(?m)^####{1,3}` "###" }}
{{- $rendered_text = $rendered_text | replaceRE `\*{3}(\S|\S.*?\S)\*{3}` "$1" }}
@@ -53,8 +53,8 @@
## Links
{{- range $refs }}
{{- $ref_index = add $ref_index 1 }}
- {{- $ref_text := replaceRE `\[(.+?)\]\((.+?)\)` "$1" . 1 }}
- {{- $ref_link := replaceRE `\[(.+?)\]\((.+?)\)` "$2" . 1 }}
+ {{- $ref_text := replaceRE `!?\[(.+?)\]\((.+?)\)` "$1" . 1 }}
+ {{- $ref_link := replaceRE `!?\[(.+?)\]\((.+?)\)` "$2" . 1 }}
{{ print "=> " $ref_link (emojify " :link: ") $ref_index ": " $ref_text | safeHTML }}
{{- end }}
{{- end }}