File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -649,17 +649,22 @@ pre div.gt-table {
649649// "Pop" code out of page margins on small screens to give a little more room
650650@include media-breakpoint-down (sm) {
651651
652+ // Same radius to all blocks even if no space is added for consistency
653+ div >pre {
654+ border-radius : 0 ;
655+ }
656+
652657 // div.section div.sourceCode pre
653- // prevents matching <pre> inside (e.g.) a <li>
654- div >div >pre {
658+ // prevents matching <pre> inside (e.g.) a <li> and <blockquote>
659+ :not ( li , blockquote ) >div >pre {
655660 margin-left : calc (var (--bs-gutter-x ) * -.5 );
656661 margin-right : calc (var (--bs-gutter-x ) * -.5 );
657- border-radius : 0 ;
658662 padding-left : 1rem ;
659663 padding-right : 1rem ;
660664 }
661665
662- .btn-copy-ex {
666+ // Relocate button for selected elements
667+ :not (li ,blockquote )>div >.btn-copy-ex {
663668 right : calc (var (--bs-gutter-x ) * -.5 + 5px );
664669 }
665670}
Original file line number Diff line number Diff line change @@ -112,6 +112,63 @@ Non-R code in `\preformatted{}`
112112yaml: [ a, b, c]
113113```
114114
115+ ### `pre` blocks
116+
117+ Testing margins and copy buttons on small screens.
118+
119+ ```r
120+ txt <- "Not wrapped; check the copy button behavior."
121+ ```
122+
123+ <section >
124+
125+ Wrapped in a ` <section> ` (e.g. ` section > div > pre ` )
126+
127+ ``` r
128+ txt <- " Wrapped in section"
129+ ```
130+
131+ </section >
132+
133+ > This is a blockquote with enough text to test the width of the code block and
134+ > verify whether it aligns with the paragraph width.
135+ >
136+ > ``` r
137+ > txt <- " Wrapped in blockquote; margins are preserved."
138+ > `` `
139+ >
140+ > Continue …
141+
142+ - This list item includes enough text to test the width of the code block and
143+ check whether it matches the paragraph width.
144+
145+ `` `r
146+ txt <- " Wrapped in li; margins are preserved."
147+ ```
148+
149+ - Another bullet.
150+
151+ 1 . Nested list.
152+
153+ 2 . Second level item with enough text to test the width of the code block
154+ and confirm alignment with the paragraph.
155+
156+ `` `r
157+ txt <- " Wrapped in li; margins are preserved."
158+ ```
159+
160+ 3 . Nested list continues.
161+
162+ < details >
163+
164+ < summary > `<pre>` block inside a `<details>` element. < / summary >
165+
166+ `` `r
167+ txt <- " Wrapped in details"
168+ ```
169+
170+ </details >
171+
115172### Crayon
116173
117174``` {r}
You can’t perform that action at this time.
0 commit comments