Skip to content

Commit 7326f84

Browse files
committed
Improve multi-signature display with stacked code block
1 parent d26eef5 commit 7326f84

2 files changed

Lines changed: 20 additions & 14 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: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1324,25 +1324,35 @@ main .method-heading .method-args {
13241324
font-weight: var(--font-weight-normal);
13251325
}
13261326

1327-
/* Type signatures — method overloads stack vertically under the name */
1328-
main .method-header .method-type-signature {
1329-
display: flex;
1330-
flex-wrap: wrap;
1331-
gap: var(--space-1);
1332-
}
1333-
1334-
main .method-type-signature code {
1327+
/* Type signatures — overloads stack as a code block under the method name */
1328+
pre.method-type-signature {
1329+
margin: 0;
1330+
padding: 0;
1331+
background: transparent;
1332+
border: none;
13351333
font-family: var(--font-code);
13361334
font-size: var(--font-size-sm);
1337-
font-weight: var(--font-weight-normal);
13381335
color: var(--color-text-secondary);
1336+
line-height: var(--line-height-normal);
1337+
white-space: pre-wrap;
1338+
overflow-wrap: break-word;
1339+
}
1340+
1341+
pre.method-type-signature code {
1342+
font-family: inherit;
1343+
font-size: inherit;
1344+
color: inherit;
13391345
background: transparent;
1346+
padding: 0;
13401347
}
13411348

13421349
/* Attribute type sigs render inline after the [RW] badge */
13431350
main .method-heading > .method-type-signature {
13441351
display: inline;
13451352
margin-left: var(--space-2);
1353+
font-family: var(--font-code);
1354+
font-size: var(--font-size-sm);
1355+
color: var(--color-text-secondary);
13461356
}
13471357

13481358
main .method-controls {

0 commit comments

Comments
 (0)