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

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

kumiDa
kumiDa19 days ago (edited 18 days ago)❀ 1

Description

  • The contents of the PR introduces the feature requested in #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

  • Why the choice of sphinx-immaterial?
    • As can be inferred from this discussion on sphinx-material theme repo at bashtage/sphinx-material#89, there's a fork of this theme which includes this light/dark toggle feature- https://jbms.github.io/sphinx-immaterial/
    • sphinx-immaterial theme is being actively maintained unlike the sphinx-material theme repo that isn't seeing active code updates.

Release notes

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

cla-bot cla-bot added cla-signed
github-actions github-actions added docs
kumiDa kumiDa force pushed from 470d4fa2 to 59e7c86a 18 days ago
kumiDa kumiDa marked this pull request as ready for review 18 days ago
kumiDa kumiDa requested a review from nineinchnick nineinchnick 18 days ago
kumiDa kumiDa requested a review from wendigo wendigo 18 days ago
kumiDa kumiDa requested a review from mosabua mosabua 18 days ago
kumiDa
kumiDa18 days agoπŸ‘ 1

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
nineinchnick18 days ago❀ 1

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
kumiDa18 days ago

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
XavieLee18 days ago

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

XavieLee
XavieLee18 days agoπŸ‘ 1

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
kumiDa17 days ago (edited 17 days ago)

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
wendigo17 days ago❀ 1

@kumiDa NICE!

wendigo
wendigo17 days agoπŸ‘ 1

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

XavieLee
XavieLee17 days ago

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

XavieLee XavieLee closed this 17 days ago
XavieLee XavieLee reopened this 17 days ago
XavieLee
XavieLee17 days ago

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

kumiDa
kumiDa16 days ago

@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
XavieLee16 days ago

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
kumiDa16 days ago

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
XavieLee16 days ago

@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 wendigo force pushed from 946509f9 to a4ec78c1 12 days ago
wendigo
wendigo12 days agoπŸ‘€ 1
wendigo
wendigo12 days agoπŸ‘ 1

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

wendigo wendigo changed the title Add feature to toggle between light & dark mode Switch documentation theme to immaterial (w/ support for dark mode) 12 days ago
wendigo wendigo force pushed from a4ec78c1 to fdddee2e 12 days ago
wendigo wendigo force pushed from fdddee2e to a67878af 12 days ago
wendigo wendigo force pushed from a67878af to dd36caaf 12 days ago
wendigo
wendigo12 days ago

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

wendigo
wendigo dismissed these changes on 2025-05-13
nineinchnick
nineinchnick12 days ago (edited 12 days ago)

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
wendigo12 days ago❀ 1
nineinchnick
nineinchnick12 days ago❀ 1

It remembers settings when hosted.

wendigo
wendigo12 days ago

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

nineinchnick
nineinchnick12 days agoπŸ‘ 1

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
kumiDa11 days ago

@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
kumiDa11 days ago

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
kumiDa11 days ago

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
nineinchnick11 days ago

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

mosabua
mosabua11 days ago

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.

mosabua
mosabua requested changes on 2025-05-13
mosabua11 days ago

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
kumiDa11 days ago (edited 11 days ago)

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
wendigo11 days ago

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

mosabua
mosabua commented on 2025-05-13
Conversation is marked as resolved
Show resolved
docs/src/main/sphinx/static/trino.css
8174 font-size: unset;
8275}
8376
84
@media only screen and (min-width: 88.25em) {
mosabua11 days ago

This might be the issue that hides the right sidebar fyi @wendigo @kumiDa .. but thats just a guess..

kumiDa10 days ago

I too had a hunch that this could be the issue, but verified that the sidebar margin was not causing the issue.
So, this possibility of cause can be struck out.

wendigo
wendigo11 days agoπŸ‘ 1

@mosabua i don't think this is it

mosabua
mosabua11 days ago
kumiDa Update sphinx theme to sphinx-immaterial
feffa1ac
kumiDa Update style to present unbulleted toctree lists
d4f5016d
wendigo wendigo force pushed from 965166e0 to d4f5016d 6 days ago
kumiDa Update configuration to fix file view & edit links
bd802958
kumiDa Update configuration to remove irrelavent version listing configs
ef8e6baf
wendigo
wendigo6 days ago

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 6 days ago
Stale

Login to write a write a comment.

Login via GitHub

Assignees
No one assigned
Labels
Milestone