-
Notifications
You must be signed in to change notification settings - Fork 31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[WIP] Add <details> directive to Sphinx extension #303
Conversation
Why not use an existing extension for this? Like something from https://sphinx-design.rtfd.io/en/furo-theme/dropdowns.html, or https://sphinx-togglebutton.rtfd.io/en/latest/, or https://sphinx-toolbox.rtfd.io/en/stable/extensions/collapse.html. |
When we were discussing this in the docs meeting, we couldn't find something IIRC. That's why I decided to try this out. https://sphinx-togglebutton.rtfd.io/en/latest/ only works with JS, which is why I would not use this. Both https://sphinx-design.readthedocs.io/en/furo-theme/dropdowns.html and https://sphinx-toolbox.readthedocs.io/en/stable/extensions/collapse.html#directive-collapse look good though. I guess we need to find out how the styling works - the second one seems to do a similar thing than this PR, the first as well but might also provide CSS (that's to be verified). |
Ok this one shows both extensions in action. The first one (step 2) is The text 'Example' can be changed on each use. I'm personally partial to the first one as I find it less visually invasive over the second one. But maybe if we are adding expand/collapse we want it 'in your face' obvious we've hidden something? |
(A little bit of context) Note that the current ansible theme is rather poor style-wise. It isn't really accessible, nor is it designed for diverse browsing environments. This extension is created by ExecutableBooks — folks coming from the scientific world that also created MyST (a markdown superset that is possible to use with Sphinx) and they also collaborate on Furo (undoubtfully the best Sphinx theme to date).
Probably yes. UX-wise, it should be obvious when some things are clickable/expandable. But either way, any of these solutions should be easily customizable with CSS. |
Oh, and I forgot to mention the existence of https://sphinx-panels.rtfd.io/en/latest/#dropdown-usage. cc @pradyunsg could you remind me which one has the best interoperability w/o JS? I seem to recall you mentioned one. |
@felixfontein not sure if you know but the Write The Docs community has a Slack instance with a |
FWIW I vote for sphinx-design, particularly because it comes from the community with a track record of maintaining their libs. |
All except https://sphinx-togglebutton.rtfd.io/en/latest/ work fine without JS. (I browse with JS disabled by default, so I'm always testing that first ;-) ) |
Both sphinx-panels and sphinx-design looks good to me. The docs on sphinx-design say: "This package arose as an iteration on sphinx-panels, with the intention to make it more flexible, easier to use, and minimise CSS clashes wth sphinx themes." (https://sphinx-design.readthedocs.io/en/furo-theme/get_started.html#migrating-from-sphinx-panels). So I second @webknjaz, let's use that one! |
Closing since the PR itself is no longer needed, and the contents are tracked in other places. |
This allows to write:
.. ansible-details:: Some RST content to hide by default.
or
to create
<details>
with optional<summary>
(the title) (ref).Currently contains #281, I can rebase when needed. The new stuff is all in c43305a.