Skip to content
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
7 changes: 3 additions & 4 deletions assets/build/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,9 @@ Promise.all(formatters.map(async ({formatter, ...options}) => {
const buildOptions = {
entryNames: watchMode ? '[name]-dev' : '[name]-[hash]',
bundle: true,
minifySyntax: !watchMode,
minifyIdentifiers: !watchMode,
// esbuild sometimes inserts erroneous space in ':is()' CSS function when whitespace minification is on: ': is()'
minifyWhitespace: false,
minifySyntax: true,
minifyIdentifiers: true,
minifyWhitespace: true,
logLevel: watchMode ? 'warning' : 'info',
...options,
plugins: [{
Expand Down
36 changes: 18 additions & 18 deletions assets/css/content/functions.css
Original file line number Diff line number Diff line change
Expand Up @@ -85,24 +85,24 @@ in both HTML and ePub. */
}
}

.content-inner .docstring:is(h2, h3, h4, h5) {
font-weight: 700;
}

.content-inner .docstring h2 {
font-size: 1.1em;
}

.content-inner .docstring h3 {
font-size: 1em;
}

.content-inner .docstring h4 {
font-size: 0.95em;
}

.content-inner .docstring h5 {
font-size: 0.9em;
/* Docstring headings */
.content-inner .docstring {
& :is(h1, h2, h3, h4, h5, h6) {
font-weight: 700;
font-size: 1em;
margin-top: 2em;
}
/* h1 not expected */
& :is(h1, h2) {
font-size: 1.1em;
}
/* h4 the last level expected: smallcaps */
& :is(h4) {
font-size: .8em;
text-transform: uppercase;
letter-spacing: .1em;
color: var(--textBody);
}
}

.content-inner div.deprecated {
Expand Down
7 changes: 2 additions & 5 deletions assets/css/content/general.css
Original file line number Diff line number Diff line change
Expand Up @@ -86,16 +86,13 @@ which we style as h2 and h3. */
margin-top: 1.75em;
}

& h2,
& :is(#summary, #callbacks, #functions) > h1.section-heading {
& h2 {
font-size: var(--h2-size);
margin-top: 1.5em;
margin-bottom: 0.5em;
}

& h3,
& :is(#summary, #callbacks, #functions) > h2.section-heading,
& #summary :is(.summary-callbacks, .summary-functions) h2 {
& h3 {
font-size: var(--h3-size);
margin-top: 1.5em;
margin-bottom: 0.5em;
Expand Down
3 changes: 2 additions & 1 deletion assets/css/content/summary.css
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
.content-inner .summary h2 a {
/* Summary section subheading (e.g., Types) */
.content-inner .summary h3 a {
text-decoration: none;
border: none;
color: var(--textHeaders) !important;
Expand Down
4 changes: 2 additions & 2 deletions lib/ex_doc/formatter/epub/templates/module_template.eex
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@

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

<%= for group <- module.docs_groups, key = text_to_id(group.title) do %>
<section id="<%= key %>" class="details-list">
<h1 class="section-heading"><%=h to_string(group.title) %></h1>
<h2 class="section-heading"><%=h to_string(group.title) %></h2>
<%= if doc = group.doc do %>
<div class="group-description" id="group-description-<%= key %>">
<%= render_doc(doc) %>
Expand Down
8 changes: 4 additions & 4 deletions lib/ex_doc/formatter/html/templates/module_template.eex
Original file line number Diff line number Diff line change
Expand Up @@ -36,24 +36,24 @@

<%= if module.docs_groups != [] do %>
<section id="summary" class="details-list">
<h1 class="section-heading">
<h2 class="section-heading">
<a class="hover-link" href="#summary">
<i class="ri-link-m" aria-hidden="true"></i>
</a>
<span class="text">Summary</span>
</h1>
</h2>
<%= for group <- module.docs_groups, do: summary_template(group.title, group.docs) %>
</section>
<% end %>

<%= for group <- module.docs_groups, key = text_to_id(group.title) do %>
<section id="<%= key %>" class="details-list">
<h1 class="section-heading">
<h2 class="section-heading">
<a class="hover-link" href="#<%= key %>">
<i class="ri-link-m" aria-hidden="true"></i>
</a>
<span class="text"><%= group.title %></span>
</h1>
</h2>
<%= if doc = group.doc do %>
<div class="group-description" id="group-description-<%= key %>">
<%= render_doc(doc) %>
Expand Down
4 changes: 2 additions & 2 deletions lib/ex_doc/formatter/html/templates/summary_template.eex
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<div class="summary-<%= text_to_id(name) %> summary">
<h2>
<h3>
<a href="#<%=h text_to_id(name) %>"><%= name %></a>
</h2>
</h3>
<%= for node <- nodes do %>
<div class="summary-row">
<div class="summary-signature">
Expand Down
2 changes: 1 addition & 1 deletion test/ex_doc/formatter/epub/templates_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ defmodule ExDoc.Formatter.EPUB.TemplatesTest do
assert content =~ ~r{<title>CompiledWithDocs [^<]*</title>}
assert content =~ ~r{<h1 id="content">\s*CompiledWithDocs\s*}

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

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