diff --git a/CHANGELOG.md b/CHANGELOG.md index 7c9010f5..247924ee 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,9 @@ This greatly improves support for native modules where no Python source code is available, for example when using PyO3. ([#390](https://github.com/mitmproxy/pdoc/issues/390), [@mhils](https://github.com/mhils)) + - Template Style Improvements: The size of headings within docstrings has been reduced. + Docstrings are now slightly indented on wide screens. + ([#383](https://github.com/mitmproxy/pdoc/issues/383), [@jacksund](https://github.com/jacksund) and [@mhils](https://github.com/mhils)) - Improve rendering of `typing.TypedDict` subclasses. ([#389](https://github.com/mitmproxy/pdoc/issues/389), [@mhils](https://github.com/mhils)) diff --git a/pdoc/templates/content.css b/pdoc/templates/content.css index c3d74bae..9102adaa 100644 --- a/pdoc/templates/content.css +++ b/pdoc/templates/content.css @@ -79,6 +79,25 @@ This makes sure that the pdoc styling doesn't leak to the rest of the page when padding: .2em 0; } +.pdoc > section:not(.module-info) h1 { + font-size: 1.5rem; + font-weight: 500; +} +.pdoc > section:not(.module-info) h2 { + font-size: 1.4rem; + font-weight: 500; +} +.pdoc > section:not(.module-info) h3 { + font-size: 1.3rem; + font-weight: 500; +} +.pdoc > section:not(.module-info) h4 { + font-size: 1.2rem; +} +.pdoc > section:not(.module-info) h5 { + font-size: 1.1rem; +} + .pdoc a { text-decoration: none; color: var(--link); @@ -124,7 +143,7 @@ This makes sure that the pdoc styling doesn't leak to the rest of the page when padding: 0; } -.pdoc > section:not(:first-of-type) { +.pdoc > section:not(.module-info) { /* this margin should collapse with docstring margin, but not for the module docstr which is followed by view_source. */ margin-bottom: 1.5rem; @@ -180,7 +199,7 @@ This makes sure that the pdoc styling doesn't leak to the rest of the page when outline: 0; } -.pdoc > section:first-of-type details > summary { +.pdoc > section.module-info details > summary { top: -20px; } @@ -189,6 +208,10 @@ This makes sure that the pdoc styling doesn't leak to the rest of the page when margin-bottom: 1.5rem; } +.pdoc section:not(.module-info) .docstring { + margin-left: clamp(0rem, 5vw - 2rem, 1rem); +} + .pdoc .docstring .pdoc-code { margin-left: 1em; margin-right: 1em; diff --git a/pdoc/templates/default/module.html.jinja2 b/pdoc/templates/default/module.html.jinja2 index 6d7096c1..26e18ed4 100644 --- a/pdoc/templates/default/module.html.jinja2 +++ b/pdoc/templates/default/module.html.jinja2 @@ -72,7 +72,7 @@ {% block content %}
{% block module_info %} -
+
{% block edit_button %} {% if edit_url %} {% if "github.com" in edit_url %} diff --git a/test/testdata/demo.html b/test/testdata/demo.html index 64eb89ad..2b96eed4 100644 --- a/test/testdata/demo.html +++ b/test/testdata/demo.html @@ -10,7 +10,7 @@ - +
-
+

demo

diff --git a/test/testdata/demo_eager.html b/test/testdata/demo_eager.html index afef0fba..bf6e506e 100644 --- a/test/testdata/demo_eager.html +++ b/test/testdata/demo_eager.html @@ -10,7 +10,7 @@ - +
-
+

demo_eager

diff --git a/test/testdata/demo_long.html b/test/testdata/demo_long.html index 084ea0e4..ab6deeb4 100644 --- a/test/testdata/demo_long.html +++ b/test/testdata/demo_long.html @@ -10,7 +10,7 @@ - +
-
+

demo_long

diff --git a/test/testdata/demopackage.html b/test/testdata/demopackage.html index e298be47..878be2d5 100644 --- a/test/testdata/demopackage.html +++ b/test/testdata/demopackage.html @@ -10,7 +10,7 @@ - +
-
+

demopackage

diff --git a/test/testdata/demopackage_dir.html b/test/testdata/demopackage_dir.html index a675cf51..51087cf0 100644 --- a/test/testdata/demopackage_dir.html +++ b/test/testdata/demopackage_dir.html @@ -63,7 +63,7 @@

index.html

- + @@ -282,7 +282,7 @@

demopackage2.html

- +
-
+

demopackage2

@@ -524,7 +524,7 @@

demopackage.html

- +
-
+
Edit on GitHub

demopackage

@@ -1027,7 +1027,7 @@

demopackage/child_c.html

- +
-
+
Edit Source

demopackage.child_c

@@ -1354,7 +1354,7 @@

demopackage/child_b.html

- +
-
+
Edit on GitLab

demopackage.child_b

@@ -1696,7 +1696,7 @@

demopackage/_child_e.html

- +
-
+
Edit on GitHub

demopackage._child_e

diff --git a/test/testdata/example_customtemplate.html b/test/testdata/example_customtemplate.html index 665a9b04..7e260ef4 100644 --- a/test/testdata/example_customtemplate.html +++ b/test/testdata/example_customtemplate.html @@ -11,7 +11,7 @@ - +
-
+

demo

diff --git a/test/testdata/example_darkmode.html b/test/testdata/example_darkmode.html index 6eeb46a7..dd3d4203 100644 --- a/test/testdata/example_darkmode.html +++ b/test/testdata/example_darkmode.html @@ -10,7 +10,7 @@ - +
-
+

demo

diff --git a/test/testdata/example_mkdocs.html b/test/testdata/example_mkdocs.html index 7b3c1d70..338cc854 100644 --- a/test/testdata/example_mkdocs.html +++ b/test/testdata/example_mkdocs.html @@ -4,7 +4,7 @@
-
+

demo

@@ -142,4 +142,4 @@

-

\ No newline at end of file + \ No newline at end of file diff --git a/test/testdata/flavors_google.html b/test/testdata/flavors_google.html index 810fdb4b..67308fd5 100644 --- a/test/testdata/flavors_google.html +++ b/test/testdata/flavors_google.html @@ -10,7 +10,7 @@ - +
-
+

flavors_google

diff --git a/test/testdata/flavors_numpy.html b/test/testdata/flavors_numpy.html index 914443e6..e6afe77e 100644 --- a/test/testdata/flavors_numpy.html +++ b/test/testdata/flavors_numpy.html @@ -10,7 +10,7 @@ - +
-
+

flavors_numpy

diff --git a/test/testdata/flavors_rst.html b/test/testdata/flavors_rst.html index 2cc82a0f..135145f7 100644 --- a/test/testdata/flavors_rst.html +++ b/test/testdata/flavors_rst.html @@ -10,7 +10,7 @@ - +
-
+

flavors_rst

diff --git a/test/testdata/math_demo.html b/test/testdata/math_demo.html index a86ea0c4..27d6d3f1 100644 --- a/test/testdata/math_demo.html +++ b/test/testdata/math_demo.html @@ -10,7 +10,7 @@ - +