diff options
| -rw-r--r-- | assets/css/common/main.css | 4 | ||||
| -rw-r--r-- | layouts/shortcodes/figure-img-size.html | 12 |
2 files changed, 16 insertions, 0 deletions
diff --git a/assets/css/common/main.css b/assets/css/common/main.css index 5bf1d3b..e02851b 100644 --- a/assets/css/common/main.css +++ b/assets/css/common/main.css @@ -224,6 +224,10 @@ figure > img { text-align: center; } +.image-size-control { + margin-left: auto; + margin-right: auto; +} .image-size-control > img { width: inherit; height: inherit; diff --git a/layouts/shortcodes/figure-img-size.html b/layouts/shortcodes/figure-img-size.html new file mode 100644 index 0000000..62c9f20 --- /dev/null +++ b/layouts/shortcodes/figure-img-size.html @@ -0,0 +1,12 @@ +{{- $width := .Get 1 }} +{{- $height := .Get 2 }} +<figure class="center align-center"> + <div class="image-size-control" style=" +{{- with $width }}max-width: {{ . }};{{ end -}} +{{- with $height }}max-height: {{ . }};{{ end -}} +"> + {{ .Page.RenderString .Inner }} + </div> + + <figcaption><p>{{ .Get 0 | markdownify }}</p></figcaption> +</figure> |
