From: Jonathan Corbet <corbet@lwn.net>
To: linux-doc@vger.kernel.org
Cc: Akira Yokosawa <akiyks@gmail.com>, Sadiya Kazi <sadiyakazi@google.com>
Subject: [PATCH RFC] docs: Add more information to the HTML sidebar
Date: Thu, 19 Jan 2023 17:11:20 -0700 [thread overview]
Message-ID: <87o7qu5al3.fsf@meer.lwn.net> (raw)
Add a new sidebar template that creates a more RTD-like "fisheye" view of
the current place in the document hierarchy. It is far from ideal, but
some readers may find it better for navigating through the documentation as
a whole.
Signed-off-by: Jonathan Corbet <corbet@lwn.net>
---
So this is just a first attempt to create a more crowded sidebar; the
result is somewhat like what RTD does; I'm not hugely happy with it, but
it's a start.
I've put a copy of the rendered docs at:
https://static.lwn.net/kerneldoc/
Thoughts? Is this headed in the right direction? This view of the TOC
is readily available from Sphinx; if we want something else it's going
to be rather more work.
Documentation/conf.py | 4 ++--
Documentation/sphinx-static/custom.css | 16 ++++++++++++++++
Documentation/sphinx/templates/kernel-toc.html | 6 ++++++
3 files changed, 24 insertions(+), 2 deletions(-)
create mode 100644 Documentation/sphinx/templates/kernel-toc.html
diff --git a/Documentation/conf.py b/Documentation/conf.py
index d927737e3c10..233f2f585143 100644
--- a/Documentation/conf.py
+++ b/Documentation/conf.py
@@ -153,7 +153,7 @@ else:
math_renderer = 'mathjax'
# Add any paths that contain templates here, relative to this directory.
-templates_path = ['_templates']
+templates_path = ['sphinx/templates']
# The suffix(es) of source filenames.
# You can specify multiple suffix as a list of string:
@@ -345,7 +345,7 @@ html_use_smartypants = False
# Custom sidebar templates, maps document names to template names.
# Note that the RTD theme ignores this
-html_sidebars = { '**': ['searchbox.html', 'localtoc.html', 'sourcelink.html']}
+html_sidebars = { '**': ['searchbox.html', 'kernel-toc.html', 'sourcelink.html']}
# about.html is available for alabaster theme. Add it at the front.
if html_theme == 'alabaster':
diff --git a/Documentation/sphinx-static/custom.css b/Documentation/sphinx-static/custom.css
index 45a624fdcf2c..1ad0899bc8f1 100644
--- a/Documentation/sphinx-static/custom.css
+++ b/Documentation/sphinx-static/custom.css
@@ -27,3 +27,19 @@ dl.function, dl.struct, dl.enum { margin-top: 2em; background-color: #ecf0f3; }
dl.function dt { margin-left: 10em; text-indent: -10em; }
dt.sig-object { font-size: larger; }
div.kernelindent { margin-left: 2em; margin-right: 4em; }
+
+/*
+ * Tweaks for our local TOC
+ */
+div.kerneltoc li.toctree-l1 { font-size: smaller;
+ text-indent: -1em;
+ margin-left: 1em; }
+div.kerneltoc li.current {font-weight: bold; }
+div.kerneltoc li.toctree-l2 { font-size: smaller;
+ text-indent: -1em;
+ margin-left: 2em;
+ list-style-type: none;
+ }
+div.kerneltoc li.current ul { margin-left: 0; }
+div.kerneltoc { background-color: #eeeeee; }
+div.kerneltoc li.current ul { background-color: white; }
diff --git a/Documentation/sphinx/templates/kernel-toc.html b/Documentation/sphinx/templates/kernel-toc.html
new file mode 100644
index 000000000000..0d2fa3748437
--- /dev/null
+++ b/Documentation/sphinx/templates/kernel-toc.html
@@ -0,0 +1,6 @@
+{# Create a local TOC the kernel way #}
+<p>
+<h3>Contents</h3>
+<div class="kerneltoc">
+{{ toctree(maxdepth=2) }}
+</div>
--
2.39.0
next reply other threads:[~2023-01-20 0:11 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-20 0:11 Jonathan Corbet [this message]
2023-01-20 2:54 ` [PATCH RFC] docs: Add more information to the HTML sidebar Bagas Sanjaya
2023-01-20 13:38 ` Sadiya Kazi
2023-01-20 14:09 ` Akira Yokosawa
2023-01-20 15:19 ` Jonathan Corbet
2023-02-03 2:37 ` Akira Yokosawa
2023-02-03 4:29 ` Sadiya Kazi
2023-01-23 0:05 ` Akira Yokosawa
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87o7qu5al3.fsf@meer.lwn.net \
--to=corbet@lwn.net \
--cc=akiyks@gmail.com \
--cc=linux-doc@vger.kernel.org \
--cc=sadiyakazi@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.