From 74c852a3c9ffacd4883d7323e3f79ad9e7f6cba8 Mon Sep 17 00:00:00 2001 From: 2bndy5 <2bndy5@gmail.com> Date: Wed, 2 Mar 2022 21:47:40 -0800 Subject: [PATCH 1/7] add rule to fix #35 --- src/assets/stylesheets/main/_api.scss | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/assets/stylesheets/main/_api.scss b/src/assets/stylesheets/main/_api.scss index ba445141b..91523f0c7 100644 --- a/src/assets/stylesheets/main/_api.scss +++ b/src/assets/stylesheets/main/_api.scss @@ -210,3 +210,9 @@ $objinfo-icon-size: 16px; border: 1px solid var(--md-default-fg-color--light); border-radius: 2px; } + +// a rule specifically designed for autosummary tables +.reference.internal .xref.py.py-obj.docutils.literal.notranslate { + // overrides `.md-typeset code { word-break: break-word; }` + word-break: normal; +} From 2ff43dbc9918a41a621a5b0d4ce8c90e7268f57d Mon Sep 17 00:00:00 2001 From: 2bndy5 <2bndy5@gmail.com> Date: Wed, 2 Mar 2022 22:20:46 -0800 Subject: [PATCH 2/7] resolve #33 --- docs/customization.rst | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/docs/customization.rst b/docs/customization.rst index a70531e02..3d5e3422c 100644 --- a/docs/customization.rst +++ b/docs/customization.rst @@ -240,6 +240,16 @@ Configuration Options - `navigation.sections `_ - `navigation.tabs `_ (only shows for browsers with large viewports) + + .. note:: + Due to a difference in general document structure between mkdocs and sphinx, any + `toctree` entry should start with a page entity (that contains a section header). + Sphinx does allow `toctree` entries to be a list of only hyperlinks, but a + navigation tab created from such an entry will only lead to the first hyperlink in + the `toctree`. + + See `issue #33 `_ for a + problematic demonstration. - `navigation.tabs.sticky `_ - `navigation.top `_ - `navigation.tracking `_ From b7cdd385f3919011dd33781f8d3bbcc7834ab149 Mon Sep 17 00:00:00 2001 From: 2bndy5 <2bndy5@gmail.com> Date: Thu, 3 Mar 2022 07:23:35 -0800 Subject: [PATCH 3/7] increase selector specificity --- src/assets/stylesheets/main/_api.scss | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/assets/stylesheets/main/_api.scss b/src/assets/stylesheets/main/_api.scss index 91523f0c7..cf7093db7 100644 --- a/src/assets/stylesheets/main/_api.scss +++ b/src/assets/stylesheets/main/_api.scss @@ -212,7 +212,7 @@ $objinfo-icon-size: 16px; } // a rule specifically designed for autosummary tables -.reference.internal .xref.py.py-obj.docutils.literal.notranslate { - // overrides `.md-typeset code { word-break: break-word; }` +// this overrides `.md-typeset code { word-break: break-word; }` +table.longtable.docutils.data.align-default tbody > tr > td > p > a.reference.internal > code.xref.py.py-obj.docutils.literal.notranslate > span.pre { word-break: normal; } From fe0bbad82ae8cc1be8176e402987d01288bef537 Mon Sep 17 00:00:00 2001 From: 2bndy5 <2bndy5@gmail.com> Date: Thu, 3 Mar 2022 07:28:48 -0800 Subject: [PATCH 4/7] shorten line length for selector --- src/assets/stylesheets/main/_api.scss | 38 ++++++++++++++++----------- 1 file changed, 23 insertions(+), 15 deletions(-) diff --git a/src/assets/stylesheets/main/_api.scss b/src/assets/stylesheets/main/_api.scss index cf7093db7..b37fb772b 100644 --- a/src/assets/stylesheets/main/_api.scss +++ b/src/assets/stylesheets/main/_api.scss @@ -10,20 +10,22 @@ $objinfo-icon-size: 16px; // Wrap in .md-typeset to ensure rules below have higher selectivity // than those in _typeset.scss. .md-typeset { + dl.objdesc, dl.api-field { - > dt { + >dt { font-family: var(--md-code-font-family); background: $api-color-header-bg; .desctype { + &, - > a.reference { + >a.reference { color: $api-color-type; // font-weight: 700; } - > a.reference:hover { + >a.reference:hover { color: var(--md-accent-fg-color); } } @@ -45,7 +47,7 @@ $objinfo-icon-size: 16px; font-weight: 700; } - a.reference > .sig-name { + a.reference>.sig-name { color: var(--md-typeset-a-color); &:hover { @@ -67,6 +69,7 @@ $objinfo-icon-size: 16px; &.sig-wrap { .sig-param { + // Ensure each parameter starts on a new line and is indented. &::before { white-space: pre; @@ -76,7 +79,8 @@ $objinfo-icon-size: 16px; } } - .sig-param + .sig-paren { + .sig-param+.sig-paren { + // Ensure the final paren starts on a new line &::before { white-space: pre; @@ -88,7 +92,7 @@ $objinfo-icon-size: 16px; } dl.objdesc { - > dt { + >dt { padding: 0.5em; font-family: var(--md-code-font-family); background: $api-color-header-bg; @@ -117,10 +121,11 @@ $objinfo-icon-size: 16px; } } - > dd { + >dd { + // Heading like "Parameters" or "Returns" dl.field-list { - > dt { + >dt { margin-bottom: 1em; font-weight: 700; font-size: 1em; @@ -130,7 +135,7 @@ $objinfo-icon-size: 16px; } dl.api-field { - > dt { + >dt { // Display as table so that background is just the width of the // content. @@ -144,9 +149,10 @@ $objinfo-icon-size: 16px; } // Make object summaries more compact - dl.objdesc.summary > dd { + dl.objdesc.summary>dd { + &, - > p:first-child { + >p:first-child { margin-top: 0; } } @@ -157,7 +163,7 @@ $objinfo-icon-size: 16px; } :root { - > * { + >* { --objinfo-icon-fg-alias: #{$clr-orange-900}; --objinfo-icon-fg-default: #{$clr-grey-800}; --objinfo-icon-fg-data: #{$clr-blue-800}; @@ -213,6 +219,8 @@ $objinfo-icon-size: 16px; // a rule specifically designed for autosummary tables // this overrides `.md-typeset code { word-break: break-word; }` -table.longtable.docutils.data.align-default tbody > tr > td > p > a.reference.internal > code.xref.py.py-obj.docutils.literal.notranslate > span.pre { - word-break: normal; -} +table.longtable.docutils.data.align-default { + tbody>tr>td>p>a.reference.internal>code.xref.py.py-obj.docutils.literal.notranslate>span.pre { + word-break: normal; + } +} From 746584f01594acb0f2e52df8d12fd345023e9b63 Mon Sep 17 00:00:00 2001 From: 2bndy5 <2bndy5@gmail.com> Date: Thu, 3 Mar 2022 07:34:12 -0800 Subject: [PATCH 5/7] decrease line length further --- src/assets/stylesheets/main/_api.scss | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/assets/stylesheets/main/_api.scss b/src/assets/stylesheets/main/_api.scss index b37fb772b..bc5af1003 100644 --- a/src/assets/stylesheets/main/_api.scss +++ b/src/assets/stylesheets/main/_api.scss @@ -220,7 +220,11 @@ $objinfo-icon-size: 16px; // a rule specifically designed for autosummary tables // this overrides `.md-typeset code { word-break: break-word; }` table.longtable.docutils.data.align-default { - tbody>tr>td>p>a.reference.internal>code.xref.py.py-obj.docutils.literal.notranslate>span.pre { - word-break: normal; + tbody>tr>td>p>a.reference.internal { + &>code.xref.py.py-obj.docutils.literal.notranslate{ + &>span.pre { + word-break: normal; + } + } } } From 6bec23f8c51b6778f0eb2c06879b7523decbf1b1 Mon Sep 17 00:00:00 2001 From: 2bndy5 <2bndy5@gmail.com> Date: Thu, 3 Mar 2022 07:47:19 -0800 Subject: [PATCH 6/7] pleasing stylelint --- src/assets/stylesheets/main/_api.scss | 37 ++++++++++++--------------- 1 file changed, 16 insertions(+), 21 deletions(-) diff --git a/src/assets/stylesheets/main/_api.scss b/src/assets/stylesheets/main/_api.scss index bc5af1003..c498f1584 100644 --- a/src/assets/stylesheets/main/_api.scss +++ b/src/assets/stylesheets/main/_api.scss @@ -10,22 +10,20 @@ $objinfo-icon-size: 16px; // Wrap in .md-typeset to ensure rules below have higher selectivity // than those in _typeset.scss. .md-typeset { - dl.objdesc, dl.api-field { - >dt { + > dt { font-family: var(--md-code-font-family); background: $api-color-header-bg; .desctype { - &, - >a.reference { + > a.reference { color: $api-color-type; // font-weight: 700; } - >a.reference:hover { + > a.reference:hover { color: var(--md-accent-fg-color); } } @@ -47,7 +45,7 @@ $objinfo-icon-size: 16px; font-weight: 700; } - a.reference>.sig-name { + a.reference > .sig-name { color: var(--md-typeset-a-color); &:hover { @@ -69,7 +67,6 @@ $objinfo-icon-size: 16px; &.sig-wrap { .sig-param { - // Ensure each parameter starts on a new line and is indented. &::before { white-space: pre; @@ -79,8 +76,7 @@ $objinfo-icon-size: 16px; } } - .sig-param+.sig-paren { - + .sig-param + .sig-paren { // Ensure the final paren starts on a new line &::before { white-space: pre; @@ -92,7 +88,7 @@ $objinfo-icon-size: 16px; } dl.objdesc { - >dt { + > dt { padding: 0.5em; font-family: var(--md-code-font-family); background: $api-color-header-bg; @@ -121,11 +117,11 @@ $objinfo-icon-size: 16px; } } - >dd { + > dd { // Heading like "Parameters" or "Returns" dl.field-list { - >dt { + > dt { margin-bottom: 1em; font-weight: 700; font-size: 1em; @@ -135,7 +131,7 @@ $objinfo-icon-size: 16px; } dl.api-field { - >dt { + > dt { // Display as table so that background is just the width of the // content. @@ -149,10 +145,9 @@ $objinfo-icon-size: 16px; } // Make object summaries more compact - dl.objdesc.summary>dd { - + dl.objdesc.summary > dd { &, - >p:first-child { + > p:first-child { margin-top: 0; } } @@ -163,7 +158,7 @@ $objinfo-icon-size: 16px; } :root { - >* { + > * { --objinfo-icon-fg-alias: #{$clr-orange-900}; --objinfo-icon-fg-default: #{$clr-grey-800}; --objinfo-icon-fg-data: #{$clr-blue-800}; @@ -220,11 +215,11 @@ $objinfo-icon-size: 16px; // a rule specifically designed for autosummary tables // this overrides `.md-typeset code { word-break: break-word; }` table.longtable.docutils.data.align-default { - tbody>tr>td>p>a.reference.internal { - &>code.xref.py.py-obj.docutils.literal.notranslate{ - &>span.pre { + tbody > tr > td > p > a.reference.internal { + > code.xref.py.py-obj.docutils.literal.notranslate { + > span.pre { word-break: normal; } } } -} +} From 326ae6215b5b5e1e05b7e9429c922fff602a8f9c Mon Sep 17 00:00:00 2001 From: 2bndy5 <2bndy5@gmail.com> Date: Thu, 3 Mar 2022 07:48:34 -0800 Subject: [PATCH 7/7] remove rogue blank line --- src/assets/stylesheets/main/_api.scss | 1 - 1 file changed, 1 deletion(-) diff --git a/src/assets/stylesheets/main/_api.scss b/src/assets/stylesheets/main/_api.scss index c498f1584..0d9fb8eed 100644 --- a/src/assets/stylesheets/main/_api.scss +++ b/src/assets/stylesheets/main/_api.scss @@ -118,7 +118,6 @@ $objinfo-icon-size: 16px; } > dd { - // Heading like "Parameters" or "Returns" dl.field-list { > dt {