Skip to content

Commit 595dc4e

Browse files
committed
Improve multi-signature display with stacked code block
1 parent 09620f5 commit 595dc4e

2 files changed

Lines changed: 37 additions & 15 deletions

File tree

lib/rdoc/generator/template/aliki/class.rhtml

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -153,11 +153,7 @@
153153
<%- end %>
154154

155155
<%- if method.type_signature %>
156-
<div class="method-type-signature">
157-
<%- method.type_signature.split("\n").each do |sig| %>
158-
<code><%= h(sig).gsub('-&gt;', '&rarr;') %></code>
159-
<%- end %>
160-
</div>
156+
<pre class="method-type-signature"><code><%= method.type_signature.split("\n").map { |sig| h(sig).gsub('-&gt;', '&rarr;') }.join("\n") %></code></pre>
161157
<%- end %>
162158
</div>
163159

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

Lines changed: 36 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1346,25 +1346,47 @@ main .method-heading .method-args {
13461346
font-weight: var(--font-weight-normal);
13471347
}
13481348

1349-
/* Type signatures — method overloads stack vertically under the name */
1350-
main .method-header .method-type-signature {
1351-
display: flex;
1352-
flex-wrap: wrap;
1353-
gap: var(--space-1);
1354-
}
1355-
1356-
main .method-type-signature code {
1349+
/* Type signatures — overloads stack as a code block under the method name */
1350+
pre.method-type-signature {
1351+
position: relative;
1352+
margin: var(--space-2) 0 0;
1353+
padding: var(--space-2) 0 0;
1354+
background: transparent;
1355+
border: none;
1356+
border-radius: 0;
1357+
overflow: visible;
13571358
font-family: var(--font-code);
13581359
font-size: var(--font-size-sm);
1359-
font-weight: var(--font-weight-normal);
1360-
color: var(--color-text-secondary);
1360+
color: var(--color-text-tertiary);
1361+
line-height: var(--line-height-tight);
1362+
white-space: pre-wrap;
1363+
overflow-wrap: break-word;
1364+
}
1365+
1366+
pre.method-type-signature::before {
1367+
content: '';
1368+
position: absolute;
1369+
top: 0;
1370+
left: 0;
1371+
right: 0;
1372+
border-top: 1px dotted var(--color-border-default);
1373+
}
1374+
1375+
pre.method-type-signature code {
1376+
font-family: inherit;
1377+
font-size: inherit;
1378+
color: inherit;
13611379
background: transparent;
1380+
padding: 0;
13621381
}
13631382

13641383
/* Attribute type sigs render inline after the [RW] badge */
13651384
main .method-heading > .method-type-signature {
13661385
display: inline;
13671386
margin-left: var(--space-2);
1387+
font-family: var(--font-code);
1388+
font-size: var(--font-size-sm);
1389+
color: var(--color-text-secondary);
13681390
}
13691391

13701392
main .method-controls {
@@ -1473,6 +1495,10 @@ main .attribute-access-type {
14731495
font-size: var(--font-size-base);
14741496
}
14751497

1498+
pre.method-type-signature {
1499+
font-size: var(--font-size-xs);
1500+
}
1501+
14761502
main .method-header {
14771503
padding: var(--space-2);
14781504
}

0 commit comments

Comments
 (0)