Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use scroll-margin-top on anchor targets #1190

Merged
merged 1 commit into from
Oct 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions lib/rdoc/generator/template/darkfish/class.rhtml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
</nav>

<main role="main" aria-labelledby="<%=h klass.aref %>">
<h1 id="<%=h klass.aref %>" class="<%= klass.type %>">
<h1 id="<%=h klass.aref %>" class="anchor-link <%= klass.type %>">
<%= klass.type %> <%= klass.full_name %>
</h1>

Expand All @@ -27,7 +27,7 @@
</section>

<%- klass.each_section do |section, constants, attributes| -%>
<section id="<%= section.aref %>" class="documentation-section">
<section id="<%= section.aref %>" class="documentation-section anchor-link">
<%- if section.title then -%>
<header class="documentation-section-title">
<h2>
Expand Down Expand Up @@ -70,7 +70,7 @@
</header>

<%- attributes.each do |attrib| -%>
<div id="<%= attrib.aref %>" class="method-detail">
<div id="<%= attrib.aref %>" class="method-detail anchor-link">
<div class="method-heading attribute-method-heading">
<a href="#<%= attrib.aref %>" title="Link to this attribute">
<span class="method-name"><%= h attrib.name %></span>
Expand All @@ -94,13 +94,13 @@
next if visibilities.empty?
visibilities.each do |visibility, methods|
next if methods.empty? %>
<section id="<%= visibility %>-<%= type %>-<%= section.aref %>-method-details" class="method-section">
<section id="<%= visibility %>-<%= type %>-<%= section.aref %>-method-details" class="method-section anchor-link">
<header>
<h3><%= visibility.to_s.capitalize %> <%= type.capitalize %> Methods</h3>
</header>

<%- methods.each do |method| -%>
<div id="<%= method.aref %>" class="method-detail <%= method.is_alias_for ? "method-alias" : '' %>">
<div id="<%= method.aref %>" class="method-detail anchor-link <%= method.is_alias_for ? "method-alias" : '' %>">
<div class="method-header">
<%- if (call_seq = method.call_seq) then -%>
<%- call_seq.strip.split("\n").each_with_index do |call_seq, i| -%>
Expand Down
4 changes: 4 additions & 0 deletions lib/rdoc/generator/template/darkfish/css/rdoc.css
Original file line number Diff line number Diff line change
Expand Up @@ -428,6 +428,10 @@ main sup {
font-size: 0.8em;
}

main .anchor-link:target {
scroll-margin-top: 20px;
}

/* The heading with the class name */
main h1[class] {
margin-top: 0;
Expand Down