Skip to content

Commit a67ece6

Browse files
Render permalink as link icon
The `link.svg` file is from [Feather icons][feather] v4.29.0, and is [licensed under the MIT license][license]. [feather]: https://feathericons.com/ [license]: https://github.com/feathericons/feather/blob/v4.29.0/LICENSE
1 parent 4bda36a commit a67ece6

File tree

4 files changed

+25
-16
lines changed

4 files changed

+25
-16
lines changed

lib/rdoc/generator/template/rails/_context.rhtml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,8 +131,11 @@
131131
<h2 class="content__divider"><%= visibility.to_s.capitalize %> <%= type %> methods</h2>
132132
<% methods.each do |method| %>
133133
<div class="method" id="<%= method.aref %>">
134-
<h3 class="method__signature"><%= method_signature method %></h3>
135-
<%= link_to "Link", method, class: "permalink", name: method.aref %>
134+
<div class="method__signature">
135+
<h3><%= method_signature method %></h3>
136+
<%= link_to %(<img src="/i/link.svg" alt="Permalink">), method,
137+
class: "method__permalink", title: "Permalink" %>
138+
</div>
136139

137140
<% unless method.aliases.empty? %>
138141
<p class="method__aka">

lib/rdoc/generator/template/rails/resources/css/main.css

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -160,9 +160,6 @@ dt
160160
overflow-x: auto;
161161
}
162162

163-
.method {
164-
position: relative;
165-
}
166163
.method h4
167164
{
168165
border-bottom: 1px dotted #999;
@@ -172,13 +169,6 @@ dt
172169
color: var(--heading-color);
173170
}
174171

175-
.method a.permalink {
176-
position: absolute;
177-
font-size: 0.9em;
178-
right: 0;
179-
top: 0;
180-
}
181-
182172
@keyframes spotlight {
183173
from { background-color: yellow; }
184174
to { background-color: white; }
@@ -485,10 +475,27 @@ html {
485475

486476
.method__signature {
487477
font-size: 1.1em;
488-
font-weight: normal;
489-
white-space: pre-wrap;
490478
padding-bottom: var(--space-sm);
491479
border-bottom: 2px solid var(--code-bg);
480+
481+
display: flex;
482+
align-items: baseline;
483+
}
484+
485+
.method__signature h3 {
486+
font-size: 1em;
487+
font-weight: normal;
488+
white-space: pre-wrap;
489+
}
490+
491+
.method__permalink {
492+
margin: 0 0 0 0.5em;
493+
}
494+
495+
.method__permalink img {
496+
font-family: monospace; /* Make em equivalent to <code>'s em */
497+
height: 1em;
498+
vertical-align: middle;
492499
}
493500

494501
.method__aka {

lib/rdoc/generator/template/rails/resources/css/reset.css

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,7 @@ b, u, i, center,
1010
dl, dt, dd, ol, ul, li,
1111
fieldset, form, label, legend,
1212
table, caption, tbody, tfoot, thead, tr, th, td {
13-
border: 0;
1413
font-size: 100%;
15-
vertical-align: baseline;
1614
background: transparent;
1715
}
1816
blockquote, q {
Lines changed: 1 addition & 0 deletions
Loading

0 commit comments

Comments
 (0)