You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit c736ea0
Browse filesBrowse the repository at this point in the historyBrowse files
Add dark-mode images for figures and markdown-basics docs (#2120)
Figures and Markdown Basics currently ship light-only elephant
screenshots, which look jarring against a dark background for readers
using the site's dark theme. Revives #1641, dropping its vendored
pandoc-ext/list-table Lua filter in favor of the native list-table
syntax Quarto 1.9 shipped after that PR went stale.
Also wires up layout-attrib-negative-dark.png, which the original PR
added but never referenced.
Copy file name to clipboardExpand all lines: docs/authoring/_table-crossrefs.md
+6Lines changed: 6 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -16,4 +16,10 @@ See @tbl-letters.
16
16
17
17
Which looks like this when rendered to HTML:
18
18
19
+
::: light-content
19
20
{fig-alt="A table with 3 columns and four rows. The text 'Table 1: My Caption' is above the header column. The text 'See tbl. 1' is aligned to the left underneath the last column." width="500"}
21
+
:::
22
+
23
+
::: dark-content
24
+
{fig-alt="A table with 3 columns and four rows. The text 'Table 1: My Caption' is above the header column. The text 'See tbl. 1' is aligned to the left underneath the last column." width="500"}
|{fig-alt="A line drawing of an elephant." width="340"} |{fig-alt="A line drawing of an elephant."} |{fig-alt="A line drawing of an elephant."} |
{fig-alt="A line drawing of an elephant." width="340"}
28
+
:::
29
+
30
+
::: dark-content
31
+
{fig-alt="A line drawing of an elephant." width="340"}
32
+
:::
33
+
-{fig-alt="A line drawing of an elephant."}
34
+
-{fig-alt="A line drawing of an elephant."}
35
+
:::
24
36
25
37
Note that for LaTeX / PDF output figures are automatically numbered (you can arrange for figures to be numbered in other formats using [Cross References](cross-references.qmd)).
26
38
@@ -139,9 +151,15 @@ format:
139
151
140
152
In HTML output formats you can add lightbox styling and behavior to images to allow a reader to click to see a larger version of the image. For example, the following image has lightbox treatment (click on the image to see lightbox in action):
Lightbox treatment can be added by adding the class `.lightbox` to an image:
162
+
Lightbox treatment can be added by adding the class `.lightbox` to an image:
145
163
146
164
```markdown
147
165
{.lightbox}
@@ -205,7 +223,13 @@ Famous Elephants
205
223
206
224
Again, the last paragraph provides the main caption, and the individual figures carry the sub-captions. Here is what this looks like when rendered as HTML:
207
225
226
+
::: light-content
208
227
{fig-alt="An artistic rendition of Surus, Hannibal's last war elephant, is on the left. Underneath this picture is the caption '(a) Surus.' On the right is a line drawing of Hanno, a famous elephant. Underneath this picture is the caption '(b) Hanno.' The words 'Figure 1: Famous elephants' are centered beneath both pictures."}
228
+
:::
229
+
230
+
::: dark-content
231
+
{fig-alt="An artistic rendition of Surus, Hannibal's last war elephant, is on the left. Underneath this picture is the caption '(a) Surus.' On the right is a line drawing of Hanno, a famous elephant. Underneath this picture is the caption '(b) Hanno.' The words 'Figure 1: Famous elephants' are centered beneath both pictures."}
232
+
:::
209
233
210
234
Note that the empty lines between the figures (and between the last figure and the caption) are required (it's what indicates that these images belong to their own paragraphs rather than being multiple images within the same paragraph).
211
235
@@ -225,7 +249,13 @@ To layout two figures with their own standalone captions (and no main caption),
225
249
:::
226
250
```
227
251
252
+
::: light-content
228
253
{fig-alt="An artistic rendition of Surus, Hannibal's last war elephant, is on the left. Underneath this picture is the caption 'Surus.' On the right is a line drawing of Hanno, a famous elephant. Underneath this picture is the caption 'Hanno.'"}
254
+
:::
255
+
256
+
::: dark-content
257
+
{fig-alt="An artistic rendition of Surus, Hannibal's last war elephant, is on the left. Underneath this picture is the caption 'Surus.' On the right is a line drawing of Hanno, a famous elephant. Underneath this picture is the caption 'Hanno.'"}
258
+
:::
229
259
230
260
You can also eliminate the captions entirely:
231
261
@@ -253,7 +283,13 @@ If you have more than 2 images, you might want to lay them out across multiple r
253
283
:::
254
284
```
255
285
286
+
::: light-content
256
287
{fig-alt="A 2x2 grid of pictures of elephants. There are labels underneath each of the pictures. Clockwise from the upper left, the labels say: Surus, Hanno, Lin Wang, and Abdul Abbas."}
288
+
:::
289
+
290
+
::: dark-content
291
+
{fig-alt="A 2x2 grid of pictures of elephants. There are labels underneath each of the pictures. Clockwise from the upper left, the labels say: Surus, Hanno, Lin Wang, and Abdul Abbas."}
292
+
:::
257
293
258
294
More complex figure arrangements (e.g. rows with varying column layouts) are possible. See the [Custom Layouts](#complex-layouts) section below for more details.
259
295
@@ -404,7 +440,13 @@ For example, this defines a layout with two equally sized figures in the first r
404
440
:::
405
441
```
406
442
443
+
::: light-content
407
444
{fig-alt="Three elephant pictures arranged such that two pictures are side-by-side in the first row, and the third picture is underneath both of these. The picture on the left in the first row is captioned 'Surus' and the picture on the right is captioned 'Hanno'. The picture underneath these two is captioned 'Lin Wang' and is as as wide and tall as the other two put together."}
445
+
:::
446
+
447
+
::: dark-content
448
+
{fig-alt="Three elephant pictures arranged such that two pictures are side-by-side in the first row, and the third picture is underneath both of these. The picture on the left in the first row is captioned 'Surus' and the picture on the right is captioned 'Hanno'. The picture underneath these two is captioned 'Lin Wang' and is as as wide and tall as the other two put together."}
449
+
:::
408
450
409
451
The `layout` attribute is a 2-dimensional array where the first dimension defines rows and the second columns. In this case `"layout="[[1,1], [1]]"` translates to: create two rows, the first of which has two columns of equal size and the second of which has a single column.
410
452
@@ -432,7 +474,13 @@ You can also use negative values to create space between elements. For example:
432
474
:::
433
475
```
434
476
477
+
::: light-content
435
478
{fig-alt="Three elephant pictures arranged such that two pictures are side-by-side in the first row, and the third picture is underneath both of these. The picture on the left in the first row is captioned 'Surus' and the picture on the right is captioned 'Hanno'. The two pictures are separated by some whitespace. The picture underneath these two is captioned 'Lin Wang' and is wider and taller than the other two put together."}
479
+
:::
480
+
481
+
::: dark-content
482
+
{fig-alt="Three elephant pictures arranged such that two pictures are side-by-side in the first row, and the third picture is underneath both of these. The picture on the left in the first row is captioned 'Surus' and the picture on the right is captioned 'Hanno'. The two pictures are separated by some whitespace. The picture underneath these two is captioned 'Lin Wang' and is wider and taller than the other two put together."}
483
+
:::
436
484
437
485
### Vertical Alignment
438
486
@@ -446,7 +494,13 @@ If you have a layout with a row of images of differing heights, you can control
446
494
:::
447
495
```
448
496
497
+
::: light-content
449
498
{fig-alt="Two pictures of elephants side by side. The picture on the left has the label 'Figure 1: Surus' underneath it. The picture on the right has the label 'Figure 2: Lin Wang' underneath it. The figure on the left is more than twice the width and height of the figure on the right."}
499
+
:::
500
+
501
+
::: dark-content
502
+
{fig-alt="Two pictures of elephants side by side. The picture on the left has the label 'Figure 1: Surus' underneath it. The picture on the right has the label 'Figure 2: Lin Wang' underneath it. The figure on the left is more than twice the width and height of the figure on the right."}
503
+
:::
450
504
451
505
Note that vertical alignment isn't limited to images, you can also vertically align any other elements that are included in a panel.
0 commit comments