Skip to content

Commit 0042785

Browse files
authored
Polish Aliki documentation theme (ruby#1742)
## Problem The Aliki HTML theme has several small visual inconsistencies that add up when browsing generated documentation: method cards and source toggles compete for attention, selected and nested navigation states create uneven spacing, page titles do not clearly distinguish object kind from object name, section dividers are visually heavy, the footer can sit awkwardly against the sidebar at narrower desktop widths, and the desktop search field is not aligned with the main reading column. These issues make the default generated docs feel less polished than the underlying content warrants, especially on method-heavy pages and wide layouts with both side navigation and the table of contents visible. ## Solution - Add a DESIGN.md contract for the Aliki theme so spacing, color, navigation, method-card, search, title, and footer decisions are documented in one place. - Refine method cards, source controls, borders, and section dividers so code-object pages read with clearer hierarchy and less visual noise. - Clarify generated navigation structure by giving the left sidebar and right table of contents distinct IDs and matching selector names. - Improve page-title kind labeling, nested sidebar spacing, and footer behavior across desktop breakpoints. - Align the desktop search field and dropdown to the main content rail while preserving the existing mobile search modal behavior. ## Screenshots ### Before <img width="1181" height="713" alt="Screenshot 2026-06-24 at 15 55 34" src="https://github.com/user-attachments/assets/50f5aea8-b32d-4223-91a4-2ff0a6b3d0c7" /> --- <img width="785" height="409" alt="Screenshot 2026-06-24 at 15 56 45" src="https://github.com/user-attachments/assets/db1780a6-5de8-4123-9edc-7394629c05e3" /> ### After <img width="1182" height="761" alt="Screenshot 2026-06-24 at 15 56 06" src="https://github.com/user-attachments/assets/c238fb25-cdfc-489d-b870-8a86b31987a2" /> --- <img width="760" height="455" alt="Screenshot 2026-06-24 at 15 56 37" src="https://github.com/user-attachments/assets/2eccc444-60fb-4bb0-a731-02d28d70c65d" />
1 parent daa7768 commit 0042785

11 files changed

Lines changed: 819 additions & 163 deletions

File tree

lib/rdoc/generator/template/aliki/DESIGN.md

Lines changed: 536 additions & 0 deletions
Large diffs are not rendered by default.

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<aside class="table-of-contents" role="complementary" aria-label="Table of Contents">
1+
<aside id="table-of-contents" class="table-of-contents" role="complementary" aria-label="Table of Contents">
22
<div class="toc-sticky">
33
<h3 class="toc-heading">On This Page</h3>
44
<nav class="toc-nav" id="toc-nav" aria-label="Page sections">
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
<div id="navigation-toggle" role="button" tabindex="0" aria-label="Toggle sidebar" aria-expanded="true" aria-controls="navigation">
1+
<div id="sidebar-navigation-toggle" role="button" tabindex="0" aria-label="Toggle sidebar" aria-expanded="false" aria-controls="sidebar-navigation">
22
<span aria-hidden="true">&#9776;</span>
33
</div>

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

Lines changed: 37 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<%= render '_header.rhtml' %>
44
<%= render '_sidebar_toggle.rhtml' %>
55

6-
<nav id="navigation" role="navigation" hidden>
6+
<nav id="sidebar-navigation" role="navigation" hidden>
77
<%= render '_sidebar_pages.rhtml' %>
88
<%= render '_sidebar_sections.rhtml' %>
99
<%= render '_sidebar_ancestors.rhtml' %>
@@ -30,8 +30,9 @@
3030
<% end %>
3131

3232
<span id="<%= h klass.legacy_aref %>" class="legacy-anchor"></span>
33-
<h1 id="<%= h klass.aref %>" class="anchor-link <%= klass.type %>">
34-
<%= klass.type %> <%= klass.full_name %>
33+
<h1 id="<%= h klass.aref %>" class="anchor-link <%= klass.type %> page-title">
34+
<span class="page-title-kind"><%= klass.type %></span>
35+
<span class="page-title-name"><%= klass.full_name %></span>
3536
</h1>
3637

3738
<section class="description">
@@ -127,44 +128,49 @@
127128
<%- methods.each do |method| %>
128129
<div id="<%= method.aref %>" class="method-detail anchor-link <%= method.is_alias_for ? "method-alias" : '' %>">
129130
<div class="method-header">
130-
<%- if (call_seq = method.call_seq) %>
131-
<%- call_seq.strip.split("\n").each_with_index do |call_seq, i| %>
131+
<div class="method-heading-group">
132+
<%- if (call_seq = method.call_seq) %>
133+
<%- call_seq.strip.split("\n").each_with_index do |call_seq, i| %>
134+
<div class="method-heading">
135+
<a href="#<%= method.aref %>" title="Link to this method">
136+
<span class="method-callseq">
137+
<%= h(call_seq.strip.
138+
gsub( /^\w+\./m, '')).
139+
gsub(/(.*)[-=]&gt;/, '\1&rarr;') %>
140+
</span>
141+
</a>
142+
</div>
143+
<%- end %>
144+
<%- elsif method.has_call_seq? %>
132145
<div class="method-heading">
133146
<a href="#<%= method.aref %>" title="Link to this method">
134-
<span class="method-callseq">
135-
<%= h(call_seq.strip.
136-
gsub( /^\w+\./m, '')).
137-
gsub(/(.*)[-=]&gt;/, '\1&rarr;') %>
138-
</span>
147+
<span class="method-name"><%= h method.name %></span>
148+
</a>
149+
</div>
150+
<%- else %>
151+
<div class="method-heading">
152+
<a href="#<%= method.aref %>" title="Link to this method">
153+
<span class="method-name"><%= h method.name %></span>
154+
<span class="method-args"><%= h method.param_seq %></span>
139155
</a>
140156
</div>
141157
<%- end %>
142-
<%- elsif method.has_call_seq? %>
143-
<div class="method-heading">
144-
<a href="#<%= method.aref %>" title="Link to this method">
145-
<span class="method-name"><%= h method.name %></span>
146-
</a>
147-
</div>
148-
<%- else %>
149-
<div class="method-heading">
150-
<a href="#<%= method.aref %>" title="Link to this method">
151-
<span class="method-name"><%= h method.name %></span>
152-
<span class="method-args"><%= h method.param_seq %></span>
153-
</a>
154-
</div>
155-
<%- end %>
156158

157-
<%- if (sig_html = type_signature_html(method, klass.path)) %>
158-
<pre class="method-type-signature"><code><%= sig_html %></code></pre>
159+
<%- if (sig_html = type_signature_html(method, klass.path)) %>
160+
<pre class="method-type-signature"><code><%= sig_html %></code></pre>
161+
<%- end %>
162+
</div>
163+
164+
<%- if method.token_stream %>
165+
<div class="method-controls">
166+
<details class="method-source-toggle">
167+
<summary><span class="method-source-icon" aria-hidden="true">{}</span> Source</summary>
168+
</details>
169+
</div>
159170
<%- end %>
160171
</div>
161172

162173
<%- if method.token_stream %>
163-
<div class="method-controls">
164-
<details class="method-source-toggle">
165-
<summary>Source</summary>
166-
</details>
167-
</div>
168174
<div class="method-source-code" id="<%= method.html_name %>-source">
169175
<pre class="<%= method.source_language %>"><%= method.markup_code %></pre>
170176
</div>

0 commit comments

Comments
 (0)