mirror of
https://github.com/alrayyes/wiki.git
synced 2025-05-12 11:40:40 +00:00
fix: image scaling for md-style links (closes #155)
This commit is contained in:
parent
d3e20b8b94
commit
eda370334a
2 changed files with 4 additions and 3 deletions
layouts/_default/_markup
|
@ -1,8 +1,9 @@
|
|||
{{$src := .Destination | safeURL }}
|
||||
{{$width := index (split .Text "|") 1 | default "auto" }}
|
||||
{{$external := strings.HasPrefix $src "http" }}
|
||||
{{- if $external -}}
|
||||
<img src="{{ $src }}" alt="{{ .Text }}" {{ with .Title }} title="{{ . }}" {{ end }} />
|
||||
<img src="{{ $src }}" width="{{ $width }}" alt="{{ .Text }}" {{ with .Title }} title="{{ . }}" {{ end }} />
|
||||
{{- else -}}
|
||||
{{$fixedUrl := (cond (hasPrefix $src "/") $src (print "/" $src)) | urlize}}
|
||||
<img src="{{.Page.Site.BaseURL}}{{ $fixedUrl }}" alt="{{ .Text }}" {{ with .Title }} title="{{ . }}" {{ end }} />
|
||||
<img src="{{.Page.Site.BaseURL}}{{ $fixedUrl }}" width="{{ $width }}" alt="{{ .Text }}" {{ with .Title }} title="{{ . }}" {{ end }} />
|
||||
{{- end -}}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue