Skip to content

Commit ed8d47e

Browse files
committed
Fix TOC layout
1 parent d8340db commit ed8d47e

File tree

1 file changed

+19
-10
lines changed
  • lib/rdoc/generator/template/aliki/css

1 file changed

+19
-10
lines changed

lib/rdoc/generator/template/aliki/css/rdoc.css

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,11 @@
162162

163163
/* Layout Dimensions */
164164
--layout-sidebar-width: 280px;
165-
--layout-toc-width: 240px;
165+
--layout-sidebar-width-min: 240px;
166+
--layout-sidebar-width-max: 15%;
167+
--layout-toc-width: 280px;
168+
--layout-toc-width-min: 240px;
169+
--layout-toc-width-max: 18%;
166170
--layout-content-max-width: 800px;
167171
--layout-header-height: 64px;
168172
--layout-search-width: 400px;
@@ -281,7 +285,7 @@ body {
281285

282286
/* Grid layout with header, sidebar, main, and footer */
283287
display: grid;
284-
grid-template-columns: var(--layout-sidebar-width) 1fr;
288+
grid-template-columns: minmax(var(--layout-sidebar-width-min), var(--layout-sidebar-width-max)) 1fr;
285289
grid-template-rows: var(--layout-header-height) 1fr auto;
286290
grid-template-areas:
287291
"header header"
@@ -292,7 +296,7 @@ body {
292296

293297
/* Three-column layout when TOC is present */
294298
body.has-toc {
295-
grid-template-columns: var(--layout-sidebar-width) 1fr var(--layout-toc-width);
299+
grid-template-columns: minmax(var(--layout-sidebar-width-min), var(--layout-sidebar-width-max)) 1fr minmax(var(--layout-toc-width-min), var(--layout-toc-width-max));
296300
grid-template-areas:
297301
"header header header"
298302
"nav main toc"
@@ -1257,16 +1261,18 @@ main header h3 {
12571261
/* 10. Right Sidebar - Table of Contents */
12581262
aside.table-of-contents {
12591263
grid-area: toc;
1260-
position: fixed;
1261-
right: 0;
1264+
align-self: start;
1265+
position: sticky;
12621266
top: var(--layout-header-height);
1263-
width: var(--layout-toc-width);
1264-
height: calc(100vh - var(--layout-header-height));
1265-
overflow: visible;
12661267
padding: var(--space-8) var(--space-6);
1268+
border: none;
12671269
border-left: 1px solid var(--border-color);
12681270
font-size: var(--font-size-base);
1269-
z-index: var(--z-sticky);
1271+
}
1272+
1273+
aside.table-of-contents * {
1274+
border-right: none !important;
1275+
outline: none !important;
12701276
}
12711277

12721278
/* Hide TOC on mobile/tablet */
@@ -1276,7 +1282,7 @@ aside.table-of-contents {
12761282
}
12771283

12781284
body.has-toc {
1279-
grid-template-columns: var(--layout-sidebar-width) 1fr;
1285+
grid-template-columns: minmax(var(--layout-sidebar-width-min), var(--layout-sidebar-width-max)) 1fr;
12801286
grid-template-areas:
12811287
"header header"
12821288
"nav main"
@@ -1330,6 +1336,9 @@ aside.table-of-contents {
13301336
text-decoration: none;
13311337
transition: color var(--transition-fast);
13321338
line-height: var(--line-height-relaxed);
1339+
word-wrap: break-word;
1340+
overflow-wrap: break-word;
1341+
hyphens: auto;
13331342
}
13341343

13351344
.table-of-contents a:hover {

0 commit comments

Comments
 (0)