Add figure shortcode

This commit is contained in:
panr 2018-12-13 08:35:47 +01:00
parent 4845a3db96
commit aa1abb8fcd
3 changed files with 46 additions and 1 deletions

View File

@ -0,0 +1,8 @@
{{ if .Get "src" }}
<figure class="{{ with .Get "position"}}{{ . }}{{ else -}} left {{- end }}" >
<img src="{{ .Get "src" | safeURL }}" {{ with .Get "alt" }} alt="{{ . | plainify }}" {{ end }} {{ with .Get "style" }} style="{{ . | safeCSS }}" {{ end }} />
{{ if .Get "caption" }}
<figcaption class="{{ with .Get "captionPosition"}}{{ . }}{{ else -}} center {{- end }}" {{ with .Get "captionStyle" }} style="{{ . | safeCSS }}" {{ end }}>{{ .Get "caption" }}</figcaption>
{{ end }}
</figure>
{{ end }}

View File

@ -94,6 +94,43 @@ img {
}
}
figure {
display: table;
max-width: 100%;
margin: 25px 0;
&.left {
margin-right: auto;
}
&.center {
margin-left: auto;
margin-right: auto;
}
&.right {
margin-left: auto;
}
figcaption {
font-size: 14px;
margin-top: 5px;
opacity: .8;
&.left {
text-align: left;
}
&.center {
text-align: center;
}
&.right {
text-align: right;
}
}
}
code {
font-family: Consolas,Monaco,Andale Mono,Ubuntu Mono,monospace;
font-feature-settings: normal;

File diff suppressed because one or more lines are too long