Skip to content

Commit a8651ea

Browse files
authored
Merge pull request #30 from trailofbits/center-captions
Center captions
2 parents b7d6ec6 + 7955cd8 commit a8651ea

File tree

3 files changed

+9
-11
lines changed

3 files changed

+9
-11
lines changed

assets/_custom.scss

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
code:first-child::before {
4949
content: "Copy";
5050
font-size: 0;
51-
background: no-repeat center url('svg/copy-regular.svg');
51+
background: no-repeat center url("svg/copy-regular.svg");
5252
width: 1.4rem;
5353
height: 1.4rem;
5454
position: absolute;
@@ -86,31 +86,29 @@ figure {
8686
> * {
8787
max-width: 95%;
8888
}
89-
9089
}
9190

9291
//border: 2px solid var(--gray-100);
9392

94-
95-
96-
97-
9893
figcaption::before {
9994
content: "Figure " counter(figureIndex) ": ";
10095
}
10196
figcaption {
97+
text-align: center;
10298
max-width: 90%;
10399
margin-top: 5px;
104100
margin-bottom: 10px;
105-
106101
font-style: italic;
107102

108-
p:first-child {
103+
p:first-child {
109104
display: inline;
110105
}
111106
}
112-
}
113107

108+
figcaption.code {
109+
margin-top: 0px; // Remove margin when a figure is code block
110+
}
111+
}
114112

115113
p {
116114
// TODO: not sure if this is without side effects

layouts/shortcodes/customFigure.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
{{ end}}
88

99
{{ if (.Get 0) }}
10-
<figcaption>{{ (.Get 0) | .Page.RenderString (dict "display" "inline") }}</figcaption>
10+
<figcaption class="code">{{ (.Get 0) | .Page.RenderString (dict "display" "inline") }}</figcaption>
1111
{{ end }}
1212
</div>
1313
</figure>

layouts/shortcodes/resourceFigure.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,4 @@
1818
<figcaption>{{ .Inner | .Page.RenderString (dict "display" "inline") }}</figcaption>
1919
{{ end }}
2020
</div>
21-
</figure>
21+
</figure>

0 commit comments

Comments
 (0)