From 579af9650eeb88aa9264d680cf2eb8e77ec61db3 Mon Sep 17 00:00:00 2001 From: Tom van Woudenberg Date: Thu, 16 Jan 2025 17:35:42 +0100 Subject: [PATCH 1/3] fix? --- README.md | 1 + .../patches/_static/fix_code_header_style.css | 3 +++ src/jupyterbook_patches/patches/layout.py | 1 + 3 files changed, 5 insertions(+) create mode 100644 src/jupyterbook_patches/patches/_static/fix_code_header_style.css diff --git a/README.md b/README.md index 1dfd495..3269742 100644 --- a/README.md +++ b/README.md @@ -3,6 +3,7 @@ This Sphinx extension fixes: - an issue where drop down menus would still take up space after being minimized, and the patch fixes it through some css. - an issue where in drop down code cells the shown summary remained lightgray instead of turning darkgrey. Fix through css. +- an issue where the size of code in a header is not the correct font size. Fix through css. ## Installation To install the Sphinx-JupyterBook-Patches, follow these steps: diff --git a/src/jupyterbook_patches/patches/_static/fix_code_header_style.css b/src/jupyterbook_patches/patches/_static/fix_code_header_style.css new file mode 100644 index 0000000..fbe6820 --- /dev/null +++ b/src/jupyterbook_patches/patches/_static/fix_code_header_style.css @@ -0,0 +1,3 @@ +h1 code, h2 code, h3 code, h4 code, h5 code, h6 code { + font-size: var(--pst-font-size-h1); +} \ No newline at end of file diff --git a/src/jupyterbook_patches/patches/layout.py b/src/jupyterbook_patches/patches/layout.py index c97169a..b8c1b3e 100644 --- a/src/jupyterbook_patches/patches/layout.py +++ b/src/jupyterbook_patches/patches/layout.py @@ -8,3 +8,4 @@ def initialize(self, app): logger.info("Initializing layout patch") app.add_css_file(filename="fix_admonition_style.css") app.add_css_file(filename="fix_dropdown_style.css") + app.add_css_file(filename="fix_code_header_style.css") From ea9de8fc50f39b0cee28f4613fec5fa4cd40cc44 Mon Sep 17 00:00:00 2001 From: Tom van Woudenberg Date: Thu, 16 Jan 2025 17:43:23 +0100 Subject: [PATCH 2/3] font size shouldn't be all h1 xd --- .../patches/_static/fix_code_header_style.css | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/jupyterbook_patches/patches/_static/fix_code_header_style.css b/src/jupyterbook_patches/patches/_static/fix_code_header_style.css index fbe6820..e25907c 100644 --- a/src/jupyterbook_patches/patches/_static/fix_code_header_style.css +++ b/src/jupyterbook_patches/patches/_static/fix_code_header_style.css @@ -1,3 +1,18 @@ -h1 code, h2 code, h3 code, h4 code, h5 code, h6 code { +h1 code { font-size: var(--pst-font-size-h1); +} +h2 code { + font-size: var(--pst-font-size-h2); +} +h3 code { + font-size: var(--pst-font-size-h3); +} +h4 code { + font-size: var(--pst-font-size-h4); +} +h5 code { + font-size: var(--pst-font-size-h5); +} +h6 code { + font-size: var(--pst-font-size-h6); } \ No newline at end of file From b32469694516d68df91058712566176a5ea8cf6e Mon Sep 17 00:00:00 2001 From: Tom van Woudenberg Date: Thu, 16 Jan 2025 17:44:54 +0100 Subject: [PATCH 3/3] maybe even nicer? --- .../patches/_static/fix_code_header_style.css | 22 +++++-------------- 1 file changed, 6 insertions(+), 16 deletions(-) diff --git a/src/jupyterbook_patches/patches/_static/fix_code_header_style.css b/src/jupyterbook_patches/patches/_static/fix_code_header_style.css index e25907c..9f61b4b 100644 --- a/src/jupyterbook_patches/patches/_static/fix_code_header_style.css +++ b/src/jupyterbook_patches/patches/_static/fix_code_header_style.css @@ -1,18 +1,8 @@ -h1 code { - font-size: var(--pst-font-size-h1); -} -h2 code { - font-size: var(--pst-font-size-h2); -} -h3 code { - font-size: var(--pst-font-size-h3); -} -h4 code { - font-size: var(--pst-font-size-h4); -} -h5 code { - font-size: var(--pst-font-size-h5); -} +h1 code, +h2 code, +h3 code, +h4 code, +h5 code, h6 code { - font-size: var(--pst-font-size-h6); + font-size: inherit; } \ No newline at end of file