Add figure shortcode

This commit is contained in:
BBaoVanC 2021-10-19 12:40:34 -05:00
parent c4e7258d69
commit b51c6c257f
Signed by: bbaovanc
GPG Key ID: 18089E4E3CCF1D3A
2 changed files with 30 additions and 0 deletions

View File

@ -106,6 +106,12 @@ img:not(.noborder), video:not(.noborder) {
border: 5px solid #1b5b9b;
}
figcaption {
font-style: italic;
font-size: small;
text-align: center;
}
a {
color: #4da6ff;
text-decoration: inherit;

View File

@ -0,0 +1,24 @@
<figure>
{{ if .Get "href" }}<a href="{{ .Get "href" }}">{{ end }}
<img src="{{ .Get "src" }}"
{{ if or (.Get "alt") (.Get "caption") }}
alt="{{ with .Get "alt" }}
{{ . }}
{{ else }}
{{ .Get "caption" | markdownify }}
{{ end }}"
{{ end }}
{{ with .Get "width" }} width="{{ . }}" {{ end }}
{{ with .Get "height" }} height="{{ . }}" {{ end }}
/>
{{ if .Get "href" }}</a>{{ end }}
{{ with .Get "caption" }}
<figcaption>
{{ . | markdownify }}
</figcaption>
{{ end }}
</figure>