diff --git a/assets/build/build.js b/assets/build/build.js index 5e4f44946..839849199 100644 --- a/assets/build/build.js +++ b/assets/build/build.js @@ -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: [{ diff --git a/assets/css/content/functions.css b/assets/css/content/functions.css index 152398614..ca50e6e12 100644 --- a/assets/css/content/functions.css +++ b/assets/css/content/functions.css @@ -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 { diff --git a/assets/css/content/general.css b/assets/css/content/general.css index c269e8fe4..9d2d36b34 100644 --- a/assets/css/content/general.css +++ b/assets/css/content/general.css @@ -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; diff --git a/assets/css/content/summary.css b/assets/css/content/summary.css index 2d6c6c7b1..e59f2d73e 100644 --- a/assets/css/content/summary.css +++ b/assets/css/content/summary.css @@ -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; diff --git a/lib/ex_doc/formatter/epub/templates/module_template.eex b/lib/ex_doc/formatter/epub/templates/module_template.eex index e75ed14c5..cf8b1cc75 100644 --- a/lib/ex_doc/formatter/epub/templates/module_template.eex +++ b/lib/ex_doc/formatter/epub/templates/module_template.eex @@ -17,14 +17,14 @@ <%= if module.docs_groups != [] do %>
-

Summary

+

Summary

<%= for group <- module.docs_groups, do: H.summary_template(group.title, group.docs) %>
<% end %> <%= for group <- module.docs_groups, key = text_to_id(group.title) do %>
-

<%=h to_string(group.title) %>

+

<%=h to_string(group.title) %>

<%= if doc = group.doc do %>
<%= render_doc(doc) %> diff --git a/lib/ex_doc/formatter/html/templates/module_template.eex b/lib/ex_doc/formatter/html/templates/module_template.eex index f0442e825..ab890bfec 100644 --- a/lib/ex_doc/formatter/html/templates/module_template.eex +++ b/lib/ex_doc/formatter/html/templates/module_template.eex @@ -36,24 +36,24 @@ <%= if module.docs_groups != [] do %>
-

+

Summary -

+ <%= for group <- module.docs_groups, do: summary_template(group.title, group.docs) %>
<% end %> <%= for group <- module.docs_groups, key = text_to_id(group.title) do %>
-

+

<%= group.title %> -

+ <%= if doc = group.doc do %>
<%= render_doc(doc) %> diff --git a/lib/ex_doc/formatter/html/templates/summary_template.eex b/lib/ex_doc/formatter/html/templates/summary_template.eex index 935148796..500518317 100644 --- a/lib/ex_doc/formatter/html/templates/summary_template.eex +++ b/lib/ex_doc/formatter/html/templates/summary_template.eex @@ -1,7 +1,7 @@
-

+

<%= name %> -

+ <%= for node <- nodes do %>
diff --git a/test/ex_doc/formatter/epub/templates_test.exs b/test/ex_doc/formatter/epub/templates_test.exs index 9ce96b970..b69938fad 100644 --- a/test/ex_doc/formatter/epub/templates_test.exs +++ b/test/ex_doc/formatter/epub/templates_test.exs @@ -125,7 +125,7 @@ defmodule ExDoc.Formatter.EPUB.TemplatesTest do assert content =~ ~r{CompiledWithDocs [^<]*} assert content =~ ~r{

\s*CompiledWithDocs\s*} - assert content =~ ~s{

Summary

} + assert content =~ ~s{

Summary

} assert content =~ ~r{

.*Example.*

}ms