Skip to content
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

DOC: Improve internal sphinx13 style #12439

Merged
merged 1 commit into from
Jun 18, 2024

Conversation

timhoffm
Copy link
Contributor

While a systematic update of the theme would be desirable, that's quite a large topic, and will likely not happen any time soon.

This PR adds a few changes to the theme to make it more readable and visually more appealing. In particular:

  • Slightly increase the font weight of headings (300 --> 400). These have been quite thin and tended to blend into the surrounding text. The increased weight makes sections a little more distinct.
    Note: The need of this seems to depends on the font used. But generally, 300 is quite thin (normal weight would be 500) and thus IMHO not too well suited for a heading.

  • Adapt the color of the search box border to sphinx-blue. Up to now, it had inherited the green from the basic style, which does not fit.
    old:
    grafik

    new:
    grafik

  • Add horizontal bars between the components of the side bar. This makes the separation between local ("On this page") and global ("Site navigation") more clear.
    grafik

  • Re-style admonitions to use colored title backgrounds. The colors make the kind of admonition more clear. Up to now, all admonitions looked similar.
    old:
    grafik

    new:
    grafik

While a systematic update of the theme would be desirable, that's quite
a large topic, and will likely not happen any time soon.

This PR adds a few changes to the theme to make it more readable and
visually more appealing. In particular:

- Slightly increase the font weight of headings (300 --> 400). These have
  been quite thin and tended to blend into the surrounding text.
  The increased weight makes sections a little more distinct.
- Adapt the color of the search box border to sphinx-blue. Up to now, it
  had inherited the green from the basic style, which does not fit.
- Add horizontal bars between the components of the side bar.
  This makes the separation between local ("On this page") and global
  ("Site navigation") more clear.
- Re-style admonitions to use colored title backgrounds. The colors
  make the kind of admonition more clear. Up to now, all admonitions
  looked similar.
@chrisjsewell
Copy link
Member

This looks great thanks!

While a systematic update of the theme would be desirable, that's quite a large topic, and will likely not happen any time soon.

Completely agree the theme needs updating 👍
I think Sphinx's own docs should be the "gold standard", and at the moment it is certainly lacking

Do you have any time/desire to work on more improvements, or ideas you would like to share?

I feel like essentially it would be great to work towards having a "built-in" https://pradyunsg.me/furo and/or even https://pradyunsg.me/lutra

@chrisjsewell chrisjsewell merged commit e30430d into sphinx-doc:master Jun 18, 2024
7 checks passed
@timhoffm
Copy link
Contributor Author

timhoffm commented Jun 19, 2024

Do you have any time/desire to work on more improvements, or ideas you would like to share?

I feel like essentially it would be great to work towards having a "built-in" https://pradyunsg.me/furo and/or even https://pradyunsg.me/lutra

I believe, #10419 covers most aspects well:

  • The default theme shold be better, the sphinx site should be better; ideally the sphinx site should use the default theme (We may deviate though: The default should work for simple docs, maybe the sphinx site is too large so that another layout is better. But in that case, both should be visually similar)
  • Writing a good theme takes substantial effort (UX, accessibitlity, configurability, ...)
  • We have backward compatibility requirements.

In all, this makes is quite difficult to move forward. I think the pragmatic approach is:

  • Add some minimal incremental improvements (quick wins like this PR) to sphinx13 so that the sphinx site looks a bit better. - It should be usable and should not scare away users.
  • Concentrate on one default builtin theme. We have 10 builtlin themes, but they have all aged and I would not recommend any of them nowadays. The core project has at most the capacity to develop/maintain one theme. Let's mark everything else as legacy (not recommended / not further developed).
  • I don't think though that sphinx13 or the default theme can be modernized completely through incremental changes. Likely a fresh start is needed, e.g. with adopting sphinx-basic-ng (Update the web theme used in Sphinx' documentation #10419 (comment) and following). I believe this can be done in a backward-compatible way as sphinx-basic-ng still builds on basic.
  • Help current users to get decent looking docs. Minimal incremental improvements to the default theme as quick wins. We should still cummunicate that this is only a basic versions and there are more refined third party themes (https://sphinx-themes.org/). Maybe even recommend some for different use cases (furo, pydata-sphinx, book).

I believe half of the task is proper documentation and communication (current state, best practices, etc.).

@timhoffm timhoffm deleted the sphinx13-style branch June 19, 2024 08:57
@chrisjsewell
Copy link
Member

Add some minimal incremental improvements (quick wins like this PR) to sphinx13 so that the sphinx site looks a bit better. It should be usable and should not scare away users.

Indeed. Just to know, do you have in mind / intend to create PRs for any more improvements?

Concentrate on one default builtin theme. We have 10 builtlin themes, but they have all aged and I would not recommend any of them nowadays.

yeh exactly, I don't know if anyone really uses them anymore 🤷

@timhoffm
Copy link
Contributor Author

Indeed. Just to know, do you have in mind / intend to create PRs for any more improvements?

W.r.t. sphinx13 style, I have aggregated the most obvious improvements into this PR. I have no concrete further plans.

There are some other improvments that users would benefit from, in alabaster (default theme), sphinx doc content, and the result of quick-start. I will be able to submit them over time, but I have enough to do so that I don't plan a systematic involvement.

chrisjsewell added a commit that referenced this pull request Jun 22, 2024
- Remove "Site navigation" header
  - this is already contextually clear (especially since separators were added in #12439)
- Hide "On this page" if `display_toc is False`
- Format "On this page" header similar to top-level site-nav sections
jfbu added a commit to jfbu/sphinx that referenced this pull request Jul 3, 2024
The colours, and also most icons, are emulated from the recent
sphinx13.css update (PR sphinx-doc#12486, PR sphinx-doc#12439).
jfbu added a commit to jfbu/sphinx that referenced this pull request Jul 6, 2024
- The colours, and also most icons, are emulated from the recent
  sphinx13.css update (PR sphinx-doc#12486, PR sphinx-doc#12439).

- Add iconpackage key to sphinxsetup key of latex_elements
  fontawesome5 is used if available, else fall-back to fontawesome.
  If none is available, drop icons and shift titles left.
  In all cases, div.<type>_title-icon keys allow user to set
  arbitrary code to be used.

- Defaults for padding and border-widths of admonitions have been
  changed, now that they all acquire a default background colour.
  The defaults always have horizontal padding plus border-width
  add up to 12.5pt, so contents of all types align exactly vertically.
  Or course user can specify arbitrary values.

- The code inserting the coloured title-row incorporates a work-around
  to a feature of TeX vertical lists when they start with for example
  a colour special.  It would not be necessary with LaTeX of 2023-06-01
  and newer. cf Improve spacing at top of minipages in
  https://www.latex-project.org/news/latex2e-news/ltnews37.pdf
@AA-Turner AA-Turner added this to the 7.4.0 milestone Jul 13, 2024
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 13, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants