Fix caption munging for captions with html

This commit is contained in:
Hadley Wickham 2022-11-18 10:46:15 -06:00
parent 89a854b7d0
commit 5895db09cd
9 changed files with 21 additions and 21 deletions

View File

@ -342,7 +342,7 @@ str(l$a)
<div class="cell-output-display">
<figure id="fig-pepper-2"><p><img src="images/pepper-1.jpg" style="width:25.0%" alt="A photo of the glass pepper shaker containing just one packet of pepper."/></p>
<figcaption>pepper[1]<code>pepper[1]</code></figcaption>
<figcaption><code>pepper[1]</code></figcaption>
</figure>
</div>
</div>
@ -350,7 +350,7 @@ str(l$a)
<div class="cell-output-display">
<figure id="fig-pepper-3"><p><img src="images/pepper-2.jpg" style="width:25.0%" alt="A photo of single packet of pepper."/></p>
<figcaption>pepper[[1]]<code>pepper[[1]]</code></figcaption>
<figcaption><code>pepper[[1]]</code></figcaption>
</figure>
</div>
</div>

View File

@ -205,7 +205,7 @@ ggplot(mpg, aes(displ, hwy)) +
<div class="cell-output-display">
<figure id="fig-just"><p><img src="communicate-plots_files/figure-html/fig-just-1.png" style="width:60.0%"/></p>
<figcaption>All nine combinations of hjust and vjust.<code>hjust</code> and <code>vjust</code>.</figcaption>
<figcaption>All nine combinations of <code>hjust</code> and <code>vjust</code>.</figcaption>
</figure>
</div>
</div>

View File

@ -440,7 +440,7 @@ Data and variable names in the column headers</h2>
<div class="cell-output-display">
<figure id="fig-pivot-names-and-values"><p><img src="diagrams/tidy-data/names-and-values.png" alt="A diagram that uses color to illustrate how the special &quot;.value&quot; sentinel works. The input has names &quot;x_1&quot;, &quot;x_2&quot;, &quot;y_1&quot;, and &quot;y_2&quot;, and we want to use the first component (&quot;x&quot;, &quot;y&quot;) as a variable name and the second (&quot;1&quot;, &quot;2&quot;) as the value for a new &quot;id&quot; column." width="540"/></p>
<figcaption>Pivoting with names_to = c(".value", "id") splits the column names into two components: the first part determines the output column name (x or y), and the second part determines the value of the id column.<code>names_to = c(".value", "id")</code> splits the column names into two components: the first part determines the output column name (<code>x</code> or <code>y</code>), and the second part determines the value of the <code>id</code> column.</figcaption>
<figcaption>Pivoting with <code>names_to = c(".value", "id")</code> splits the column names into two components: the first part determines the output column name (<code>x</code> or <code>y</code>), and the second part determines the value of the <code>id</code> column.</figcaption>
</figure>
</div>
</div>

View File

@ -178,7 +178,7 @@ ggplot(data = mpg) +
<div class="cell-output-display">
<figure id="fig-shapes"><p><img src="data-visualize_files/figure-html/fig-shapes-1.png" alt="Mapping between shapes and the numbers that represent them: 0 - square, 1 - circle, 2 - triangle point up, 3 - plus, 4 - cross, 5 - diamond, 6 - triangle point down, 7 - square cross, 8 - star, 9 - diamond plus, 10 - circle plus, 11 - triangles up and down, 12 - square plus, 13 - circle cross, 14 - square and triangle down, 15 - filled square, 16 - filled circle, 17 - filled triangle point-up, 18 - filled diamond, 19 - solid circle, 20 - bullet (smaller circle), 21 - filled circle blue, 22 - filled square blue, 23 - filled diamond blue, 24 - filled triangle point-up blue, 25 - filled triangle point down blue." width="576"/></p>
<figcaption>R has 25 built in shapes that are identified by numbers. There are some seeming duplicates: for example, 0, 15, and 22 are all squares. The difference comes from the interaction of the color and fill aesthetics. The hollow shapes (014) have a border determined by color; the solid shapes (1520) are filled with color; the filled shapes (2124) have a border of color and are filled with fill.<code>color</code> and <code>fill</code> aesthetics. The hollow shapes (014) have a border determined by <code>color</code>; the solid shapes (1520) are filled with <code>color</code>; the filled shapes (2124) have a border of <code>color</code> and are filled with <code>fill</code>.</figcaption>
<figcaption>R has 25 built in shapes that are identified by numbers. There are some seeming duplicates: for example, 0, 15, and 22 are all squares. The difference comes from the interaction of the <code>color</code> and <code>fill</code> aesthetics. The hollow shapes (014) have a border determined by <code>color</code>; the solid shapes (1520) are filled with <code>color</code>; the filled shapes (2124) have a border of <code>color</code> and are filled with <code>fill</code>.</figcaption>
</figure>
</div>
</div>

View File

@ -501,7 +501,7 @@ y &lt;- tribble(
<div class="cell-output-display">
<figure id="fig-join-setup"><p><img src="diagrams/join/setup.png" alt="x and y are two data frames with 2 columns and 3 rows, with contents as described in the text. The values of the keys are coloured: 1 is green, 2 is purple, 3 is orange, and 4 is yellow." width="160"/></p>
<figcaption>Graphical representation of two simple tables. The coloured key columns map background colour to key value. The grey columns represent the “value” columns that are carried along for the ride.<code>key</code> columns map background colour to key value. The grey columns represent the “value” columns that are carried along for the ride.</figcaption>
<figcaption>Graphical representation of two simple tables. The coloured <code>key</code> columns map background colour to key value. The grey columns represent the “value” columns that are carried along for the ride.</figcaption>
</figure>
</div>
</div>
@ -519,7 +519,7 @@ y &lt;- tribble(
<div class="cell-output-display">
<figure id="fig-join-inner"><p><img src="diagrams/join/inner.png" alt="x and y are placed at right-angles with lines forming a grid of potential matches. Keys 1 and 2 appear in both x and y, so we get a match, indicated by a dot. Each dot corresponds to a row in the output, so the resulting joined data frame has two rows." width="363"/></p>
<figcaption>An inner join matches each row in x to the row in y that has the same value of key. Each match becomes a row in the output.<code>x</code> to the row in <code>y</code> that has the same value of <code>key</code>. Each match becomes a row in the output.</figcaption>
<figcaption>An inner join matches each row in <code>x</code> to the row in <code>y</code> that has the same value of <code>key</code>. Each match becomes a row in the output.</figcaption>
</figure>
</div>
</div>
@ -530,7 +530,7 @@ y &lt;- tribble(
<div class="cell-output-display">
<figure id="fig-join-left"><p><img src="diagrams/join/left.png" alt="Compared to the previous diagram showing an inner join, the y table gets a new virtual row containin NA that will match any row in x that didn't otherwise match. This means that the output now has three rows. For key = 3, which matches this virtual row, val_y takes value NA." width="385"/></p>
<figcaption>A visual representation of the left join where every row in x appears in the output.<code>x</code> appears in the output.</figcaption>
<figcaption>A visual representation of the left join where every row in <code>x</code> appears in the output.</figcaption>
</figure>
</div>
</div>
@ -541,7 +541,7 @@ y &lt;- tribble(
<div class="cell-output-display">
<figure id="fig-join-right"><p><img src="diagrams/join/right.png" alt="Compared to the previous diagram showing an left join, the x table now gains a virtual row so that every row in y gets a match in x. val_x contains NA for the row in y that didn't match x." width="380"/></p>
<figcaption>A visual representation of the right join where every row of y appears in the output.<code>y</code> appears in the output.</figcaption>
<figcaption>A visual representation of the right join where every row of <code>y</code> appears in the output.</figcaption>
</figure>
</div>
</div>
@ -552,7 +552,7 @@ y &lt;- tribble(
<div class="cell-output-display">
<figure id="fig-join-full"><p><img src="diagrams/join/full.png" alt="Now both x and y have a virtual row that always matches. The result has 4 rows: keys 1, 2, 3, and 4 with all values from val_x and val_y, however key 2, val_y and key 4, val_x are NAs since those keys don't have a match in the other data frames." width="388"/></p>
<figcaption>A visual representation of the full join where every row in x and y appears in the output.<code>x</code> and <code>y</code> appears in the output.</figcaption>
<figcaption>A visual representation of the full join where every row in <code>x</code> and <code>y</code> appears in the output.</figcaption>
</figure>
</div>
</div>
@ -575,7 +575,7 @@ Row matching</h2>
<div class="cell-output-display">
<figure id="fig-join-match-types"><p><img src="diagrams/join/match-types.png" alt="A join diagram where x has key values 1, 2, and 3, and y has key values 1, 2, 2. The output has three rows because key 1 matches one row, key 2 matches two rows, and key 3 matches zero rows." width="348"/></p>
<figcaption>The three ways a row in x can match. x1 matches one row in y, x2 matches two rows in y, x3 matches zero rows in y. Note that while there are three rows in x and three rows in the output, there isnt a direct correspondence between the rows.<code>x</code> can match. <code>x1</code> matches one row in <code>y</code>, <code>x2</code> matches two rows in <code>y</code>, <code>x3</code> matches zero rows in y. Note that while there are three rows in <code>x</code> and three rows in the output, there isnt a direct correspondence between the rows.</figcaption>
<figcaption>The three ways a row in <code>x</code> can match. <code>x1</code> matches one row in <code>y</code>, <code>x2</code> matches two rows in <code>y</code>, <code>x3</code> matches zero rows in y. Note that while there are three rows in <code>x</code> and three rows in the output, there isnt a direct correspondence between the rows.</figcaption>
</figure>
</div>
</div>
@ -684,7 +684,7 @@ Filtering joins</h2>
<div class="cell-output-display">
<figure id="fig-join-semi"><p><img src="diagrams/join/semi.png" alt="A join diagram with old friends x and y. In a semi join, only the presence of a match matters so the output contains the same columns as x." width="318"/></p>
<figcaption>In a semi-join it only matters that there is a match; otherwise values in y dont affect the output.<code>y</code> dont affect the output.</figcaption>
<figcaption>In a semi-join it only matters that there is a match; otherwise values in <code>y</code> dont affect the output.</figcaption>
</figure>
</div>
</div>
@ -692,7 +692,7 @@ Filtering joins</h2>
<div class="cell-output-display">
<figure id="fig-join-anti"><p><img src="diagrams/join/anti.png" alt="An anti-join is the inverse of a semi-join so matches are drawn with red lines indicating that they will be dropped from the output." width="317"/></p>
<figcaption>An anti-join is the inverse of a semi-join, dropping rows from x that have a match in y.<code>x</code> that have a match in <code>y</code>.</figcaption>
<figcaption>An anti-join is the inverse of a semi-join, dropping rows from <code>x</code> that have a match in <code>y</code>.</figcaption>
</figure>
</div>
</div>
@ -717,7 +717,7 @@ Non-equi joins</h1>
<div class="cell-output-display">
<figure id="fig-inner-both"><p><img src="diagrams/join/inner-both.png" alt="A join diagram showing an inner join betwen x and y. The result now includes four columns: key.x, val_x, key.y, and val_y. The values of key.x and key.y are identical, which is why we usually only show one. " width="415"/></p>
<figcaption>An left join showing both x and y keys in the output.<code>x</code> and <code>y</code> keys in the output.</figcaption>
<figcaption>An left join showing both <code>x</code> and <code>y</code> keys in the output.</figcaption>
</figure>
</div>
</div>
@ -726,7 +726,7 @@ Non-equi joins</h1>
<div class="cell-output-display">
<figure id="fig-join-gte"><p><img src="diagrams/join/gte.png" alt="A join diagram illustrating join_by(key &gt;= key). The first row of x matches one row of y and the second and thirds rows each match two rows. This means the output has five rows containing each of the following (key.x, key.y) pairs: (1, 1), (2, 1), (2, 2), (3, 1), (3, 2)." width="385"/></p>
<figcaption>A non-equi join where the x key must greater than or equal to than the y key. Many rows generate multiple matches.<code>x</code> key must greater than or equal to than the <code>y</code> key. Many rows generate multiple matches.</figcaption>
<figcaption>A non-equi join where the <code>x</code> key must greater than or equal to than the <code>y</code> key. Many rows generate multiple matches.</figcaption>
</figure>
</div>
</div>
@ -749,7 +749,7 @@ Cross joins</h2>
<div class="cell-output-display">
<figure id="fig-join-cross"><p><img src="diagrams/join/cross.png" alt="A join diagram showing a dot for every combination of x and y." width="155"/></p>
<figcaption>A cross join matches each row in x with every row in y.<code>x</code> with every row in <code>y</code>.</figcaption>
<figcaption>A cross join matches each row in <code>x</code> with every row in <code>y</code>.</figcaption>
</figure>
</div>
</div>
@ -778,7 +778,7 @@ Inequality joins</h2>
<div class="cell-output-display">
<figure id="fig-join-lt"><p><img src="diagrams/join/lt.png" width="185"/></p>
<figcaption>An inequality join where x is joined to y on rows where the key of x is less than the key of y. This makes a triangular shape in the top-left corner.<code>x</code> is joined to <code>y</code> on rows where the key of <code>x</code> is less than the key of <code>y</code>. This makes a triangular shape in the top-left corner.</figcaption>
<figcaption>An inequality join where <code>x</code> is joined to <code>y</code> on rows where the key of <code>x</code> is less than the key of <code>y</code>. This makes a triangular shape in the top-left corner.</figcaption>
</figure>
</div>
</div>

View File

@ -253,7 +253,7 @@ Boolean algebra</h1>
<div class="cell-output-display">
<figure id="fig-bool-ops"><p><img src="diagrams/transform.png" alt="Six Venn diagrams, each explaining a given logical operator. The circles (sets) in each of the Venn diagrams represent x and y. 1. y &amp; !x is y but none of x; x &amp; y is the intersection of x and y; x &amp; !y is x but none of y; x is all of x none of y; xor(x, y) is everything except the intersection of x and y; y is all of y and none of x; and x | y is everything." width="395"/></p>
<figcaption>The complete set of boolean operations. x is the left-hand circle, y is the right-hand circle, and the shaded region show which parts each operator selects.<code>x</code> is the left-hand circle, <code>y</code> is the right-hand circle, and the shaded region show which parts each operator selects.</figcaption>
<figcaption>The complete set of boolean operations. <code>x</code> is the left-hand circle, <code>y</code> is the right-hand circle, and the shaded region show which parts each operator selects.</figcaption>
</figure>
</div>
</div>

View File

@ -739,7 +739,7 @@ flights |&gt;
<div class="cell-output-display">
<figure id="fig-flights-dist-daily"><p><img src="numbers_files/figure-html/fig-flights-dist-daily-1.png" alt="The distribution of `dep_delay` is highly right skewed with a strong peak slightly less than 0. The 365 frequency polygons are mostly overlapping forming a thick black bland." width="576"/></p>
<figcaption>365 frequency polygons of dep_delay, one for each day. The frequency polygons appear to have the same shape, suggesting that its reasonable to compare days by looking at just a few summary statistics.<code>dep_delay</code>, one for each day. The frequency polygons appear to have the same shape, suggesting that its reasonable to compare days by looking at just a few summary statistics.</figcaption>
<figcaption>365 frequency polygons of <code>dep_delay</code>, one for each day. The frequency polygons appear to have the same shape, suggesting that its reasonable to compare days by looking at just a few summary statistics.</figcaption>
</figure>
</div>
</div>

View File

@ -150,7 +150,7 @@ str(x5)
<div class="cell-output-display">
<figure id="fig-view-expand-2"><p><img src="screenshots/View-3.png" alt="Another screenshot, having expanded the grandchild of x4 to see its two children, again a double vector and a list. " width="689"/></p>
<figcaption>You can repeat this operation as many times as needed to get to the data youre interested in. Note the bottom-left corner: if you click an element of the list, RStudio will give you the subsetting code needed to access it, in this case x4[[2]][[2]][[2]].<code>x4[[2]][[2]][[2]]</code>.</figcaption>
<figcaption>You can repeat this operation as many times as needed to get to the data youre interested in. Note the bottom-left corner: if you click an element of the list, RStudio will give you the subsetting code needed to access it, in this case <code>x4[[2]][[2]][[2]]</code>.</figcaption>
</figure>
</div>
</div>

View File

@ -11,7 +11,7 @@
<div class="cell-output-display">
<figure id="fig-pipe-options"><p><img src="screenshots/rstudio-pipe-options.png" alt="Screenshot showing the &quot;Use native pipe operator&quot; option which can be found on the &quot;Editing&quot; panel of the &quot;Code&quot; options." width="616"/></p>
<figcaption>To insert |&gt;, make sure the “Use native pipe operator” option is checked.<code>|&gt;</code>, make sure the “Use native pipe operator” option is checked.</figcaption>
<figcaption>To insert <code>|&gt;</code>, make sure the “Use native pipe operator” option is checked.</figcaption>
</figure>
</div>
</div>