Skip to content

Commit e8a46c6

Browse files
committed
Change headings' levels to match their context
1 parent 9cd866c commit e8a46c6

6 files changed

Lines changed: 13 additions & 15 deletions

File tree

assets/css/content/general.css

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -86,16 +86,13 @@ which we style as h2 and h3. */
8686
margin-top: 1.75em;
8787
}
8888

89-
& h2,
90-
& :is(#summary, #types, #callbacks, #functions) > h1.section-heading {
89+
& h2 {
9190
font-size: var(--h2-size);
9291
margin-top: 1.5em;
9392
margin-bottom: 0.5em;
9493
}
9594

96-
& h3,
97-
& :is(#summary, #types, #callbacks, #functions) > h2.section-heading,
98-
& #summary :is(.summary-types, .summary-callbacks, .summary-functions) h2 {
95+
& h3 {
9996
font-size: var(--h3-size);
10097
margin-top: 1.5em;
10198
margin-bottom: 0.5em;

assets/css/content/summary.css

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
.content-inner .summary h2 a {
1+
/* Summary section subheading (e.g., Types) */
2+
.content-inner .summary h3 a {
23
text-decoration: none;
34
border: none;
45
color: var(--textHeaders) !important;

lib/ex_doc/formatter/epub/templates/module_template.eex

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,14 @@
1717

1818
<%= if module.docs_groups != [] do %>
1919
<section id="summary" class="details-list">
20-
<h1 class="section-heading">Summary</h1>
20+
<h2 class="section-heading">Summary</h2>
2121
<%= for group <- module.docs_groups, do: H.summary_template(group.title, group.docs) %>
2222
</section>
2323
<% end %>
2424

2525
<%= for group <- module.docs_groups, key = text_to_id(group.title) do %>
2626
<section id="<%= key %>" class="details-list">
27-
<h1 class="section-heading"><%=h to_string(group.title) %></h1>
27+
<h2 class="section-heading"><%=h to_string(group.title) %></h2>
2828
<%= if doc = group.doc do %>
2929
<div class="group-description" id="group-description-<%= key %>">
3030
<%= render_doc(doc) %>

lib/ex_doc/formatter/html/templates/module_template.eex

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,24 +36,24 @@
3636

3737
<%= if module.docs_groups != [] do %>
3838
<section id="summary" class="details-list">
39-
<h1 class="section-heading">
39+
<h2 class="section-heading">
4040
<a class="hover-link" href="#summary">
4141
<i class="ri-link-m" aria-hidden="true"></i>
4242
</a>
4343
<span class="text">Summary</span>
44-
</h1>
44+
</h2>
4545
<%= for group <- module.docs_groups, do: summary_template(group.title, group.docs) %>
4646
</section>
4747
<% end %>
4848

4949
<%= for group <- module.docs_groups, key = text_to_id(group.title) do %>
5050
<section id="<%= key %>" class="details-list">
51-
<h1 class="section-heading">
51+
<h2 class="section-heading">
5252
<a class="hover-link" href="#<%= key %>">
5353
<i class="ri-link-m" aria-hidden="true"></i>
5454
</a>
5555
<span class="text"><%= group.title %></span>
56-
</h1>
56+
</h2>
5757
<%= if doc = group.doc do %>
5858
<div class="group-description" id="group-description-<%= key %>">
5959
<%= render_doc(doc) %>

lib/ex_doc/formatter/html/templates/summary_template.eex

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<div class="summary-<%= text_to_id(name) %> summary">
2-
<h2>
2+
<h3>
33
<a href="#<%=h text_to_id(name) %>"><%= name %></a>
4-
</h2>
4+
</h3>
55
<%= for node <- nodes do %>
66
<div class="summary-row">
77
<div class="summary-signature">

test/ex_doc/formatter/epub/templates_test.exs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ defmodule ExDoc.Formatter.EPUB.TemplatesTest do
125125
assert content =~ ~r{<title>CompiledWithDocs [^<]*</title>}
126126
assert content =~ ~r{<h1 id="content">\s*CompiledWithDocs\s*}
127127

128-
assert content =~ ~s{<h1 class="section-heading">Summary</h1>}
128+
assert content =~ ~s{<h2 class="section-heading">Summary</h2>}
129129

130130
assert content =~
131131
~r{<h2 id="module-example-unicode-escaping">.*Example.*</h2>}ms

0 commit comments

Comments
 (0)