diff --git a/assets/css/content/functions.css b/assets/css/content/functions.css index f823e909c..2d5f14775 100644 --- a/assets/css/content/functions.css +++ b/assets/css/content/functions.css @@ -16,8 +16,8 @@ } .content-inner .detail-header { - margin: 2 0 1em; - padding: 0.5em 1em; + margin: 1em 0; + padding: 0.5em 0.85em 0.5em 1em; background-color: var(--textDetailBackground); border-left: 3px solid var(--textDetailAccent); font-size: 1em; @@ -25,12 +25,7 @@ position: relative; } -.content-inner .detail-header .note { - float: right; -} - .content-inner .detail-header .signature { - display: inline-block; font-family: var(--monoFontFamily); font-size: 1rem; font-weight: 700; @@ -62,6 +57,10 @@ } } +.content-inner .detail-header .icon-action { + margin-top: 3px; +} + .content-inner .specs pre { font-family: var(--monoFontFamily); font-size: 0.9em; diff --git a/assets/css/content/general.css b/assets/css/content/general.css index 9561f48b7..5ecb0a0be 100644 --- a/assets/css/content/general.css +++ b/assets/css/content/general.css @@ -7,6 +7,40 @@ color: var(--textBody); } +.content-inner .heading-with-actions { + display: flex; + flex-wrap: wrap; + justify-content: flex-end; + align-items: start; + gap: 6px; +} +.content-inner .heading-with-actions > *:not(h1) { + flex-shrink: 0; +} +.content-inner .heading-with-actions h1 { + flex-grow: 1; + justify-self: flex-start; + max-width: 100%; + margin: 0; + overflow-wrap: break-word; +} +.content-inner .heading-with-actions .icon-action { + width: 20px; + height: 20px; + display: flex; + justify-content: center; + align-items: center; + font-weight: normal; +} +.content-inner .heading-with-actions.top-heading .icon-action { + padding-top: 1.5rem; + font-size: 1.2rem; +} + +.content-inner .top-heading { + padding-top: 1rem; +} + .content-inner :is(h1, h2, h3, h4, h5, h6) { font-family: var(--sansFontFamily); font-weight: 700; @@ -20,10 +54,6 @@ margin: 0.5em 0; } -.content-inner h1.signature { - margin: 0; -} - .content-inner h1.section-heading { margin: 1.5em 0 0.5em; } @@ -32,11 +62,6 @@ font-weight: 300; } -.content-inner h1 .icon-action { - font-size: 1.2rem; - font-weight: normal; -} - .content-inner h2 { font-size: 1.6em; padding-top: 1em; @@ -65,7 +90,6 @@ } .content-inner .icon-action { - float: right; color: var(--iconAction); text-decoration: none; border: none; @@ -73,9 +97,6 @@ background-color: transparent; cursor: pointer; } -.content-inner button.icon-action { - margin-top: 12px; -} .content-inner .icon-action:hover { color: var(--iconActionHover); } diff --git a/lib/ex_doc/formatter/html/templates/detail_template.eex b/lib/ex_doc/formatter/html/templates/detail_template.eex index c3d2ed43a..89459e886 100644 --- a/lib/ex_doc/formatter/html/templates/detail_template.eex +++ b/lib/ex_doc/formatter/html/templates/detail_template.eex @@ -6,15 +6,17 @@ -

<%=h node.signature %>

- <%= if node.source_url do %> - - - - <% end %> - <%= for annotation <- node.annotations do %> - (<%= annotation %>) - <% end %> +
+

<%=h node.signature %>

+ <%= for annotation <- node.annotations do %> + (<%= annotation %>) + <% end %> + <%= if node.source_url do %> + + + + <% end %> +
<%= if deprecated = node.deprecated do %>
diff --git a/lib/ex_doc/formatter/html/templates/extra_template.eex b/lib/ex_doc/formatter/html/templates/extra_template.eex index 86a23e25e..1b835f034 100644 --- a/lib/ex_doc/formatter/html/templates/extra_template.eex +++ b/lib/ex_doc/formatter/html/templates/extra_template.eex @@ -2,22 +2,21 @@ <%= sidebar_template(config, type, nodes_map) %>
-

+
+

<%= node.title_content %>

+ <%= if type == :cheatmd do %> + + <% end %> <%= if node.source_url do %> View Source <% end %> - <%= if type == :cheatmd do %> - - <% end %> - - <%= node.title_content %> -

+
<%= if type == :livemd do %>
diff --git a/lib/ex_doc/formatter/html/templates/module_template.eex b/lib/ex_doc/formatter/html/templates/module_template.eex index b509f167b..3c2394e37 100644 --- a/lib/ex_doc/formatter/html/templates/module_template.eex +++ b/lib/ex_doc/formatter/html/templates/module_template.eex @@ -2,19 +2,21 @@ <%= sidebar_template(config, module.type, nodes_map) %>
-

+
+

+ <%= module.title %> <%= module_type(module) %> + (<%= config.project %> v<%= config.version %>) + <%= for annotation <- module.annotations do %> + (<%= annotation %>) + <% end %> +

<%= if module.source_url do %> View Source <% end %> - <%= module.title %> <%= module_type(module) %> - (<%= config.project %> v<%= config.version %>) - <%= for annotation <- module.annotations do %> - (<%= annotation %>) - <% end %> -

+
<%= if deprecated = module.deprecated do %>
@@ -54,4 +56,5 @@
<% end %> + <%= footer_template(config, module) %> diff --git a/test/ex_doc/formatter/html_test.exs b/test/ex_doc/formatter/html_test.exs index 80c2845b2..bc24d8bb0 100644 --- a/test/ex_doc/formatter/html_test.exs +++ b/test/ex_doc/formatter/html_test.exs @@ -108,8 +108,8 @@ defmodule ExDoc.Formatter.HTMLTest do foo_content = EasyHTML.parse!(File.read!("#{c.tmp_dir}/html/readme-1.html"))["#content"] bar_content = EasyHTML.parse!(File.read!("#{c.tmp_dir}/html/readme-2.html"))["#content"] - assert to_string(foo_content["h1 > span"]) == "README foo" - assert to_string(bar_content["h1 > span"]) == "README bar" + assert to_string(foo_content["h1"]) == "README foo" + assert to_string(bar_content["h1"]) == "README bar" end test "warns when generating an index.html file with an invalid redirect", @@ -499,14 +499,14 @@ defmodule ExDoc.Formatter.HTMLTest do content = File.read!(tmp_dir <> "/html/plaintextfiles.html") - assert content =~ ~r{Plain Text Files.*}s + assert content =~ ~r{Plain Text Files}s assert content =~ ~r{

Read the license and the plain-text file.} plain_text_file = File.read!(tmp_dir <> "/html/plaintext.html") - assert plain_text_file =~ ~r{PlainText.*}s + assert plain_text_file =~ ~r{PlainText}s assert plain_text_file =~ ~r{

\nThis is plain\n  text and nothing\n.+\s+good bye\n
}s @@ -516,14 +516,14 @@ defmodule ExDoc.Formatter.HTMLTest do license = File.read!(tmp_dir <> "/html/license.html") - assert license =~ ~r{LICENSE.*}s + assert license =~ ~r{LICENSE}s assert license =~ ~s{
\nLicensed under the Apache License, Version 2.0 (the "License")}
 
       content = File.read!(tmp_dir <> "/html/livebookfile.html")
 
-      assert content =~ ~r{Title for Livebook Files\s*}
+      assert content =~ ~r{Title for Livebook Files}
 
       assert content =~
                ~s{ "/html/plaintextfiles.html")
 
-      assert content =~ ~r{Plain Text Files.*}s
+      assert content =~ ~r{Plain Text Files}s
 
       assert content =~
                ~r{

Read the license and the plain-text file.}