[RFC] Update LLVM docs to furo theme

This RFC suggests updating the LLVM documentation pages (https://llvm.org/docs/) to use the furo theme (https://github.com/pradyunsg/furo) instead of the current custom theme. Note that furo is also used for LLDB documentation (https://lldb.llvm.org/).

I’ve prototyped what this looks like off a recent snapshot at https://nigham.github.io/llvm_docs_furo/.

The primary benefits / motivations are:

  • The minimal look is more consistent with current expectation of documents and looks similar to most markdown based rendering.
  • Supports dark mode (and defaults to device preference).
  • Much easier navigation with sidebar table of contents vs only at the top.
  • Existing precedent with LLDB documentation which has been working well.
  • Offers higher information density even though it’s more comfortable to read (see desktop comparison below)
  • Rendering and reading flow is much better on smaller screens / mobile devices (see comparison below).

(see also similar proposal for libc docs)

I have a draft PR out that implements this – primarily this updates the theme, adds the new LLVM logo as a resource, and updates rst files to drop the explicit "contents” directive which is not needed for furo. This might need a bit of cleanup (e.g. remove the old theme files etc) which I can work on if the community is in favor of this change.

12 Likes

This looks like a big visual upgrade to me, +1!

I agree with this! Looks much better and more modern

Visually it looks like a massive improvement, but the center column is a bit too narrow so in AMDGPUUsage, there are many tables that need horizontal scrolling. The navigation columns are also a bit narrow so titles are often on 2 lines: User Guide for AMDGPU Backend - LLVM

Is it possible to make it so both left/right columns are wider, and snap to their respective side ? The center column can then fill all the available space between them.

Thank you for the proposal! I thinks it’s an improvement and I appreciate that the site works well without JS. I did note some minor annoyances, though:

  • The table of contents for LangRef is now a lot less useful than before. (It is also annoying (hardly possible) to search, because it comes after the content, but that’s probably not worth fixing.)
  • I personally find the left sidebar to be rather distracting on the main content pages? On a half screen, I’d much rather have an always-visible TOC than the side bar (which I can’t hide without user styles). I find it also annoying in a text-only browser like links (although the skip to content link is still an improvement to the status quo).
  • My Firefox adds margin: 8px to body which is a bit annoying while scrolling, maybe this could be fixed by adding body{margin: 0} somewhere?

Overall I’m also in favor of a change, although some amount of charm will be lost :frowning:

It seems like the most prominent objective difference is:

  • The current theme handles small viewports poorly.
  • The proposed theme handles large docsets poorly (per the README: “Biased for smaller docsets — intended for smaller documentation sets, where presenting the entire hierarchy in the sidebar is not overwhelming.”)

I would personally prefer to keep the nicer experience on larger screens, as I don’t tend to develop on a phone or tablet, but ideally we would improve one without regressing the other.

Maybe we could tweak some CSS values? Commenting out a single line of CSS makes the new theme much more useable for me:

.sidebar-container, .toc-drawer {
  box-sizing: border-box;
  /* width: 15em; */
}

(This probably breaks some other things, but maybe the original author is available to give feedback on whether changing this makes sense?)

And the issues with things like tables being scrolled might be addressable with a bit of work, e.g. changing this and dependant values:

.content {
  width: 46em;
}

It seems like we also limit the depth of headers that appear in the ToC on some pages of the current site? Not sure if that can just be carried over to the new theme, or if it is baked into our custom theme.

A final small nit: It seems like there isn’t @media print support in the Furo theme, so parts of the printed pages are covered by “Skip to Content” buttons and stuff. The existing theme doesn’t seem to consider print media specifically, but doesn’t do anything clever enough to strictly require it.

2 Likes

I thought we had a GSOC in 2024 to update the theme, and that was completed? Is there any reason we haven’t switched to that?

LLVM.org Website Redesign Project Wrap Up .

1 Like

All of this is down to personal preference, but I’ve never liked these mobile focused designs, especially how they use side-content. I like to make use of my browser’s zoom feature and they never behave, half the time I inspect element to delete the sidebars so I can actually read the content without a third of the screen being dedicated to sidebars.

4 Likes

That was for redesigning the main website (llvm.org), and did not have anything to do with project documentation (this proposal) as far as I’m aware.

Oh, I thought it was kind of intended for everything, including docs.

We discussed this proposal in the last @infra-area-team meeting and we like the overall direction but also see value in consistency. If we decide to move forward with this change, we think it’d be best implemented across all LLVM projects. Furthermore, if we decide to tailor the Furo theme to better fit LLVM needs, we should do so in a way that all projects can share.

Thank you for proposal! Overall +1

New version also looks better on ultra-wide screens (21:9 ratio). Here is comparison:

The old style has awkward white strip with nothing on the right side while new version use compact central-aligment which is much easier to read.

2 Likes

Looks nice! I found a tiny problem in the ToC. The arrow next to “LLVM Extension” doesn’t do anything.

Thank you everyone for the feedback. Replying to some specific issues – sorry for the delay:

@Pierre-vh @slinder1 @jhuber6 : Re wide monitors

I’ve experimented with some custom CSS to add better wide-screen support. PTAL at LangRef, AMDGPU Usage to see if this looks better.

@aengelke : The table of contents for LangRef is now a lot less useful than before

@slinder1 : It seems like we also limit the depth of headers that appear in the ToC on some pages of the current site?

You’re right. It looks like furo intentionally expands all levels; we should likely solve this by updating the LangRef.rst to not have the “Syntax” headings etc as headings but maybe as bolded text. I’m happy to make that change if this proposal is approved.

@aengelke : I personally find the left sidebar to be rather distracting on the main content pages

There seems to be no easy way to turn off the left sidebar, sorry.

@aengelke : My Firefox adds margin: 8px to body which is a bit annoying

I don’t see this (on Chrome) – why would a 8px margin be an issue while scrolling? While it is possible to override the body CSS, I’m not sure it would be ideal for everyone, for me having text very close to the left of the screen feels not great.

@slinder1 : It seems like there isn’t @media print support in the Furo theme,

This seems right, I don’t know of a good way (outside of extensive customization) to fix this.

@petrhosek + @infra-area-team : we think it’d be best implemented across all LLVM projects

LLDB and libc have already moved over to furo. MLIR has a different theme but looks fairly modern, I think if we do want to update it we might want a separate RFC; this proposal does move us closer to consistency. I’m happy to open up an MLIR RFC after this one but I think it may be OK for MLIR to keep their theme if they want it.

@petrhosek + @infra-area-team : if we decide to tailor the Furo theme to better fit LLVM needs, we should do so in a way that all projects can share

There’s really not much other than naming the theme and adding a single custom CSS file for the wide support and the updated LLVM logo – this is very easy to share across projects – the heavy lifting is all furo.

I think this is just because there are no subpages there anymore (llvm-project/llvm/docs/Extensions.rst at main · llvm/llvm-project · GitHub vs llvm-project/llvm/docs/Reference.rst at main · llvm/llvm-project · GitHub)

We probably need to remove the .. toctree:: directive, I can do that separately.

This looks a lot better, thanks. Is it possible to make tables take the full width of the page by default ? Right now some tables in AMDGPUUsage take half the screen and it looks a bit weird. e.g. User Guide for AMDGPU Backend - LLVM

One thing to be cautious about with consistency is that it can make it hard to tell which site you’re on. I was thinking about this a bit when I proposed the same theme for libc and lldb uses. If I have multiple tabs open, it can be difficult to remember which one I was looking at.

If LLVM does move towards this, it would be nice if each project had a colour or something that could be used as a top bar or bottom bar to give a visual indicator for which site is being looked at.

1 Like

FWIW, I personally really like the style of “readthedocs”: Getting Started: Overview & Installing Initial Project — Sphinx Tutorial 1.0 documentation

I find that it’s the right balance between aesthetics, and functionality. There is only one sidebar there which helps readability IMO.

1 Like

Notice the white border at the top and left of the sidebar. When scrolling down, the sidebar first scrolls by 8px before it gets sticky, which is annoying. This margin is part of Firefox’s default browser styles and shouldn’t be there. (And TBH, I don’t find “I don’t see this on Chrome” to be an adequate response here.)

+1. Although I’m not sure how well this would handle large documents like LangRef if the TOC is merged on the left. Then again, we could probably split LangRef (e.g. splice out intrinsics).

1 Like

Something as simple as this largely resolves the print issue:

@media print {
    pre {
        white-space: pre-wrap !important;
    }
    .content-icon-container,
    .skip-to-content,
    .back-to-top {
        display: none !important;
    }
}

If anyone wants to carry that as an upstream PR or include it in our extensions if/when we switch, I contribute it under the usual LLVM license or whatever license Furo accepts :slight_smile: