Skip to content

Support additional themes in config #2594

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 1 commit into
base: master
Choose a base branch
from

Conversation

tmandry
Copy link
Member

@tmandry tmandry commented Mar 14, 2025

This removes the need for replacing all of index.hbs just to have a custom theme.

Closes #2048.

@expikr
Copy link
Contributor

expikr commented Mar 22, 2025

Very nice, can you also copy over my Orange example to the test book as well, so that the PR can be fully superceded?

@ehuss
Copy link
Contributor

ehuss commented Apr 21, 2025

Some drive-by comments:

One issue we've had is that the id generated for the theme selector can conflict with id's used in headers and other places. For example, you can't have a header like ## Rust because it conflicts with the Rust color scheme. I don't know how we can better handle that, and I worry a little that supporting additional themes will make it harder to fix that (or make collisions more likely). That's probably not a blocker, but I figured I'd bring it up since I worry about it.

I'd also like to understand a little more how other generators work. #2048 discusses that a little, but I haven't had time to read and understand. I'm just trying to understand what the tradeoffs or alternate designs are here.

I also wonder what if the user wants to remove a stock theme, how do they do that?

I assume this works with all the options in output.html like default-theme and preferred-dark-theme?

I've been slightly uncomfortable that there is some muddled terminology here. "theme" in mdbook is a directory that allows you to completely customize how a page is rendered. Then there is also a "color theme" which is just a css class and a selector. The two are only loosely releated, and I worry about the potential confusion around them. I don't know why it was structured that way.

Otherwise seems like it would be fun to support this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Status: waiting on a review
Projects
None yet
4 participants