Skip to content

Switch documentation theme to immaterial (w/ support for dark mode) #25735

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

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

kumiDa
Copy link
Contributor

@kumiDa kumiDa commented May 5, 2025

Description

  • The contents of the PR introduces the feature requested in Support Light/Dark Mode Toggle for Documentation #25719
  • Configuration and respective setup files are update to use sphinx-immaterial theme.
  • Styling files are amended to use the theme customization options provided by the theme to achieve the same look and feel as before while introducing the light/dark toggle feature.
  • Local TOCtree is displayed in the left sidebar
  • The theme can be toggled between the following modes
    • Auto mode: as per browser setting
      Screenshot_20250506_192945
    • Light mode
      Screenshot_20250506_193005
    • Dark mode
      Screenshot_20250506_193019

Additional context and related issues

Release notes

(x ) Release notes are required. Please propose a release note for me.

@cla-bot cla-bot bot added the cla-signed label May 5, 2025
@github-actions github-actions bot added the docs label May 5, 2025
@kumiDa kumiDa force-pushed the feature/enable-docs-theme-toggle branch from 470d4fa to 59e7c86 Compare May 6, 2025 13:55
@kumiDa kumiDa marked this pull request as ready for review May 6, 2025 14:05
@kumiDa kumiDa requested review from nineinchnick, wendigo and mosabua May 6, 2025 14:05
@kumiDa
Copy link
Contributor Author

kumiDa commented May 6, 2025

Note to the reviewers, the docker image used in the CI to validate this PR has to be updated to include the new sphinx-immaterial theme

@nineinchnick
Copy link
Member

I'm very excited about using this new theme because it supports Mermaid charts, and we could use to make some doc pages easier to understand.

@kumiDa
Copy link
Contributor Author

kumiDa commented May 6, 2025

I'm very excited about using this new theme because it supports Mermaid charts, and we could use to make some doc pages easier to understand.

Would love to work with the team in this effort too!!

@XavieLee
Copy link
Member

XavieLee commented May 7, 2025

Hi @kumiDa , the right sidebar can not show under this theme on my side, are u meet the same issue?

@XavieLee
Copy link
Member

XavieLee commented May 7, 2025

btw, this theme still in beta, it has some UI bugs like sidebar, icon, css etc,
Google Chrome 2025-05-07 16 45 27
image
image

So we may explore other themes, and consider using sphinx-immaterial when it is ready.

@kumiDa
Copy link
Contributor Author

kumiDa commented May 7, 2025

btw, this theme still in beta, it has some UI bugs like sidebar, icon, css etc, Google Chrome 2025-05-07 16 45 27 image image

So we may explore other themes, and consider using sphinx-immaterial when it is ready.

This behaviour is due to the use of following configuration toc.sticky which is detailed in https://jbms.github.io/sphinx-immaterial/customization.html#configuration-options as :

toc.sticky

Makes headings in the left and right sidebars “sticky”, such that the full path to each heading remains visible even as the sidebars are scrolled.

I've removed this config in 083720e, as keeping the TOC sticky was anyways not supported in Trino 475-SNAPSHOT Documentation

Now the UI issue noticed is resolved.
Screenshot_20250507_212631

@wendigo
Copy link
Contributor

wendigo commented May 7, 2025

@kumiDa NICE!

@wendigo
Copy link
Contributor

wendigo commented May 7, 2025

I'm adding sphinx image to docker-images: trinodb/docker-images#236

@XavieLee
Copy link
Member

XavieLee commented May 8, 2025

Hi @kumiDa I mean this icon issue, u can check it under function and operators. image

@XavieLee XavieLee closed this May 8, 2025
@XavieLee XavieLee reopened this May 8, 2025
@XavieLee
Copy link
Member

XavieLee commented May 8, 2025

@kumiDa Do u have icon issue on left sidebar? An additional icon will be displayed.
image

@kumiDa
Copy link
Contributor Author

kumiDa commented May 8, 2025

@kumiDa Do u have icon issue on left sidebar? An additional icon will be displayed. image

@XavieLee, thanks for checking this.

This is intended more a feature than an bug, as documented here - https://sphinx-immaterial.readthedocs.io/en/latest/apidoc/index.html#objconf-toc_icon_class

This TOCtree is consistent with changes made in 2ca072b

Screenshot_20250508_192523

@XavieLee
Copy link
Member

XavieLee commented May 8, 2025

Yes, I found the reason and fixed it already. Thank u! @kumiDa

BTW, why don't you upgrade to the latest version?
I upgrade it and keep the necessary configuration, u can refer to it if you need. #25733

@kumiDa
Copy link
Contributor Author

kumiDa commented May 8, 2025

BTW, why don't you upgrade to the latest version? I upgrade it and keep the necessary configuration, u can refer to it if you need. #25733

@XavieLee, Thanks for the suggestion. Which version are you suggesting about? I didn't quite understand what you are referring to here.

@XavieLee
Copy link
Member

XavieLee commented May 8, 2025

@XavieLee, Thanks for the suggestion. Which version are you suggesting about? I didn't quite understand what you are referring to here.

@kumiDa I mean using sphinx==8.2.3. Since we have changed the theme to sphinx-immaterial and use its latest version, sphinx can also be upgraded together. After testing, the latest version works well and does not require much change. What do you think?

@wendigo
Copy link
Contributor

wendigo commented May 13, 2025

@nineinchnick ptal

@wendigo
Copy link
Contributor

wendigo commented May 13, 2025

Rebased and solved conflicts. 115 release is ongoing so this is suppose to fail (I'll retrigger build once release is done)

@wendigo
Copy link
Contributor

wendigo commented May 13, 2025

@wendigo wendigo changed the title Add feature to toggle between light & dark mode Switch documentation theme to immaterial (w/ support for dark mode) May 13, 2025
wendigo
wendigo previously approved these changes May 13, 2025
@nineinchnick
Copy link
Member

nineinchnick commented May 13, 2025

I only found two issues. The first one is the left navbar has different styles:

  1. open the top section page:
    Screenshot 2025-05-13 at 10 40 05
  2. open any subsection:
    Screenshot 2025-05-13 at 10 41 15

The second issue is that it detects my system preferences, but doesn't remember if I switch the theme manually. Maybe this is caused when opening it locally. It looks like it remembers the setting per page, not the whole site.

I like how tables use a more compact font. Syntax highlight and note/warning boxes look great. It also looks fine in responsive mode (on mobile).

@wendigo
Copy link
Contributor

wendigo commented May 13, 2025

@nineinchnick can you test in the https://wendigo.pl/trino-docs/ ?

@nineinchnick
Copy link
Member

It remembers settings when hosted.

@wendigo
Copy link
Contributor

wendigo commented May 13, 2025

@nineinchnick I've made small change, Idk whether it's better: https://wendigo.pl/trino-docs/optimizer/statistics

@nineinchnick
Copy link
Member

It's better, we can merge it like this. I'll post it on Slack to give others a chance to take a look, since this change has a very high impact.

@kumiDa
Copy link
Contributor Author

kumiDa commented May 13, 2025

@nineinchnick can you test in the https://wendigo.pl/trino-docs/ ?

Thanks for hosting this @wendigo to test the changes. I was able to verify the changes I expected.

@kumiDa
Copy link
Contributor Author

kumiDa commented May 13, 2025

I've fixed a little problem with code highlighting (white dots due to a border radius in the dark mode)

Ah! The code blocks look clean now.

@kumiDa
Copy link
Contributor Author

kumiDa commented May 13, 2025

I like how tables use a more compact font. Syntax highlight and note/warning boxes look great. It also looks fine in responsive mode (on mobile).

@nineinchnick , how do you feel about the table headings? I kind of felt they are unintuitively smaller in font than the Table content.

@nineinchnick
Copy link
Member

It's fine for me, all tables have a font of 14px, both headers and content. Regular text is 17px.

@mosabua
Copy link
Member

mosabua commented May 13, 2025

Great work on this PR so far @kumiDa .. sorry I have not been able to help. Please ensure that the look and feel for the default remains as unchanged as possible or is definitely a listed and known improvement.

I just had a very short look - the ToC sections now have bullets.. these should be removed - compare https://trino.io/docs/current/ and https://wendigo.pl/trino-docs/ .. I hope to be able to look some more later this week.

Copy link
Member

@mosabua mosabua left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just noticed that the right hand navigation for each page also seems to be gone. We definitely need that .. there are some very long pages and without that nav it is very hard to find things.

@kumiDa
Copy link
Contributor Author

kumiDa commented May 13, 2025

the ToC sections now have bullets.. these should be removed

Thanks for reviewing the changes @mosabua!

The changes to retain the unbulleted toctree listing is made in 965166e

@wendigo
Copy link
Contributor

wendigo commented May 13, 2025

Right sidebar is still missing. I tried to figure this out but no luck

@wendigo
Copy link
Contributor

wendigo commented May 13, 2025

@mosabua i don't think this is it

@mosabua
Copy link
Member

mosabua commented May 13, 2025

Well... it muse be supported somehow - see https://sphinx-immaterial.readthedocs.io/en/latest/apidoc/format_signatures.html

@mosabua
Copy link
Member

mosabua commented May 13, 2025

@wendigo
Copy link
Contributor

wendigo commented May 18, 2025

It seems to me that switching to immaterial is not an option as it breaks too many thing and we are getting little in return

@wendigo wendigo dismissed their stale review May 18, 2025 20:59

Stale

@kumiDa kumiDa force-pushed the feature/enable-docs-theme-toggle branch from ef8e6ba to 94b49cf Compare May 26, 2025 14:10
@kumiDa
Copy link
Contributor Author

kumiDa commented May 27, 2025

@mosabua, the right side local TOCs are now visible through this commit 3339b50.

Please share your reviews.

Screenshot from 2025-05-27 17-37-43

@kumiDa kumiDa requested a review from mosabua May 27, 2025 12:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

5 participants