Skip to content

Commit d3b36af

Browse files
committed
Fix issues on pre rendering r-lib/pkgdown#2970
1 parent ea1c6f9 commit d3b36af

3 files changed

Lines changed: 73 additions & 5 deletions

File tree

inst/pkgdown/assets/BS5/rogtemplate.css

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,13 +221,22 @@ code {
221221
}
222222

223223
@media (max-width: 575.98px) {
224+
/* See https://github.com/r-lib/pkgdown/pull/2970 */
225+
224226
div > pre {
227+
border-radius: 0;
228+
}
229+
230+
:not(li, blockquote) > div > pre {
225231
margin-left: calc(var(--bs-gutter-x) * -0.5);
226232
margin-right: calc(var(--bs-gutter-x) * -0.5);
227-
border-radius: 0;
228233
padding-left: 1rem;
229234
padding-right: 1rem;
230235
}
236+
237+
:not(li, blockquote) > div > .btn-copy-ex {
238+
right: calc(var(--bs-gutter-x) * -0.5 + 5px);
239+
}
231240
}
232241

233242
/* Highlighter based in tango for dark theme */

inst/pkgdown/assets/BS5/rogtemplate.min.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vignettes/test/rendering.Rmd

Lines changed: 62 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,8 @@ Second paragraph
5252

5353
```{r}
5454
1 + 2
55-
```
55+
``
56+
`
5657
</details>
5758
5859
## Tables
@@ -119,6 +120,63 @@ Non-R code in `\preformatted{}`
119120
yaml: [a, b, c]
120121
```
121122
123+
### `pre` blocks
124+
125+
Testing margins and copy buttons on small screens.
126+
127+
```r
128+
txt <- "Not wrapped; check the copy button behavior."
129+
```
130+
131+
<section>
132+
133+
Wrapped in a `<section>` (e.g. `section > div > pre`)
134+
135+
```r
136+
txt <- "Wrapped in section"
137+
```
138+
139+
</section>
140+
141+
> This is a blockquote with enough text to test the width of the code block and
142+
> verify whether it aligns with the paragraph width.
143+
>
144+
> ```r
145+
> txt <- "Wrapped in blockquote; margins are preserved."
146+
> ```
147+
>
148+
> Continue
149+
150+
- This list item includes enough text to test the width of the code block and
151+
check whether it matches the paragraph width.
152+
153+
```r
154+
txt <- "Wrapped in li; margins are preserved."
155+
```
156+
157+
- Another bullet.
158+
159+
1. Nested list.
160+
161+
2. Second level item with enough text to test the width of the code block
162+
and confirm alignment with the paragraph.
163+
164+
```r
165+
txt <- "Wrapped in li; margins are preserved."
166+
```
167+
168+
3. Nested list continues.
169+
170+
<details>
171+
172+
<summary>`<pre>` block inside a `<details>` element.</summary>
173+
174+
```r
175+
txt <- "Wrapped in details"
176+
```
177+
178+
</details>
179+
122180
### Crayon
123181

124182
```{r}
@@ -128,7 +186,8 @@ cat(cli::col_blue("This is blue\n"), "\n")
128186
message(cli::col_green("This is green"))
129187
130188
warning(cli::style_bold("This is bold"))
131-
```
189+
`
190+
``
132191
Some text
133192
134193
```{r}
@@ -214,4 +273,4 @@ Guten tag.
214273

215274
This word should be broken across multiple lines on mobile, rather than making the page scroll horizontally:
216275

217-
Ccccccccccccaaaaaaaaaaaaaaatttttttttttttttttssssssssssssssss
276+
Ccccccccccccaaaaaaaaaaaaaaatttttttttttttttttssssssssssssssss

0 commit comments

Comments
 (0)