Commit 2c93b01
fix: use absolute positioning for copy button in code blocks (#684)
* fix: use absolute positioning for copy button in code blocks
The copy button was using `float: right` which caused it to take up
space in the document flow, resulting in an extra empty line appearing
at the bottom of code blocks.
Switch to `position: absolute` with `right: 1rem` and `bottom: 1rem`
to overlay the button without affecting the code block layout. This
also adds `position: relative` to `pre` elements to establish the
positioning context.
Refs: #635
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* fix: add code block toolbar with language label and copy button
Replace the floating copy button with a dedicated toolbar at the bottom
of code blocks that includes a language label and copy button. This
resolves the visual issue where the copy button caused an empty-line
appearance at the bottom of code blocks.
Changes:
- Add createToolbarElement() to generate toolbar with language label
- Update copy button click handler to use closest('pre') for robust
DOM traversal
- Add .code-toolbar flex layout and .code-language styling
- Update print media query to hide toolbar instead of copy button
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
---------
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>1 parent 49b7173 commit 2c93b01
File tree
3 files changed
+36
-16
lines changed- src
- generators/legacy-html/assets
- utils
3 files changed
+36
-16
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
180 | 180 | | |
181 | 181 | | |
182 | 182 | | |
183 | | - | |
| 183 | + | |
184 | 184 | | |
185 | 185 | | |
186 | 186 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
540 | 540 | | |
541 | 541 | | |
542 | 542 | | |
543 | | - | |
| 543 | + | |
544 | 544 | | |
545 | 545 | | |
546 | 546 | | |
| |||
1014 | 1014 | | |
1015 | 1015 | | |
1016 | 1016 | | |
| 1017 | + | |
| 1018 | + | |
| 1019 | + | |
| 1020 | + | |
| 1021 | + | |
| 1022 | + | |
| 1023 | + | |
| 1024 | + | |
| 1025 | + | |
| 1026 | + | |
| 1027 | + | |
| 1028 | + | |
| 1029 | + | |
| 1030 | + | |
| 1031 | + | |
| 1032 | + | |
| 1033 | + | |
1017 | 1034 | | |
1018 | | - | |
1019 | 1035 | | |
1020 | 1036 | | |
1021 | 1037 | | |
| |||
1028 | 1044 | | |
1029 | 1045 | | |
1030 | 1046 | | |
1031 | | - | |
1032 | 1047 | | |
1033 | 1048 | | |
1034 | 1049 | | |
| |||
1132 | 1147 | | |
1133 | 1148 | | |
1134 | 1149 | | |
1135 | | - | |
| 1150 | + | |
1136 | 1151 | | |
1137 | 1152 | | |
1138 | 1153 | | |
| |||
1147 | 1162 | | |
1148 | 1163 | | |
1149 | 1164 | | |
1150 | | - | |
| 1165 | + | |
1151 | 1166 | | |
1152 | 1167 | | |
1153 | 1168 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
13 | | - | |
14 | | - | |
15 | | - | |
16 | | - | |
17 | | - | |
18 | | - | |
19 | | - | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
20 | 25 | | |
21 | 26 | | |
22 | 27 | | |
| |||
103 | 108 | | |
104 | 109 | | |
105 | 110 | | |
106 | | - | |
107 | | - | |
| 111 | + | |
| 112 | + | |
108 | 113 | | |
109 | 114 | | |
110 | 115 | | |
| |||
165 | 170 | | |
166 | 171 | | |
167 | 172 | | |
168 | | - | |
| 173 | + | |
169 | 174 | | |
170 | 175 | | |
171 | 176 | | |
| |||
0 commit comments