feat: image scaling (closes #131)

This commit is contained in:
Jacky Zhao 2022-06-29 17:34:05 -07:00
parent e884f4927f
commit 8b2fba895a
3 changed files with 8 additions and 6 deletions

View file

@ -27,10 +27,8 @@
{{$inner := . | strings.TrimPrefix "![[" | strings.TrimSuffix "]]" }}
{{$split := split $inner "|"}}
{{$path := index $split 0 | relURL}}
{{$reference := split $path "#"}}
{{$title := index $reference 0}}
{{$display := default $title (index $split 1)}}
{{$img := printf "<img src=\"%s\" title=\"%s\">" $path $display}}
{{$width := index $split 1}}
{{$img := printf "<img src=\"%s\" width=\"%s\" />" $path (default "auto" $width)}}
{{$content = replace $content . $img}}
{{else}}
{{$inner := . | strings.TrimPrefix "[[" | strings.TrimSuffix "]]" }}