-
Notifications
You must be signed in to change notification settings - Fork 31
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
WIP: axomdbook #335
WIP: axomdbook #335
Conversation
This is... arguably shippable as written? just marking it WIP due to my lack of confidence in the approach. |
--color-axo-pink: hsla(326, 100%, 73%, 1); | ||
--color-axo-pink-dark: hsla(326, 52%, 58%, 1); | ||
--color-axo-orange: hsla(0, 87%, 70%, 1); | ||
--color-axo-orange-dark: hsla(356, 75%, 64%, 1); | ||
--color-axo-highlighter: hsla(51, 100%, 50%, 1); | ||
--color-axo-black: hsla(0, 0%, 5%, 1); | ||
|
||
--title-fg: var(--color-axo-pink); | ||
--main-font: Comfortaa; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thankfully mdbook is already heavily variable'd, so 95% of the theme is just settings vars. These are the values we ostensibly want tailwind to inject.
The remaining 5% are:
- a couple more surgical edits to the "real" css to introduce distinctions where we want to make two things that were previously styled the same in mdbook have different styling to more closely match oranda/axo
- --title-fg and --main-font are new variables that govern these distinctions; all other themes avoid setting these, triggering default values.
- edit to the JS to change the localStorage key for the theme, to avoid conflicts when someone launches a local mdbook that doesn't have the axo theme (causes that other mdbook's JS to crash)
- edit to the JS to tell mdbook that "axo" is a dark theme (affects the JS that does code block syntax highlighting)
See https://github.com/axodotdev/axomdbook/issues for some out-standing issues with the actual theme See axodotdev/axomdbook@0a052c6 for the precise edits that were made to the default mdbook theme See https://rust-lang.github.io/mdBook/format/theme/index.html for docs on mdbook themeing |
fn deserialize_toml_edit(src: &SourceFile) -> Result<toml_edit::Document> { | ||
let toml = src | ||
.contents() | ||
.parse::<toml_edit::Document>() | ||
.map_err(|details| { | ||
let span = details.span().map(|span| span.into()); | ||
OrandaError::TomlEdit { | ||
source: src.clone(), | ||
span, | ||
details, | ||
} | ||
})?; | ||
Ok(toml) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FIXME: factor into axoasset (cargo-dist also uses a variation of this for editing Cargo.toml in init)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
--fg: #bcbdd0; | ||
|
||
--sidebar-bg: var(--color-axo-black); | ||
--sidebar-fg: var(--color-axo-orange); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
--sidebar-fg: var(--color-axo-orange); | |
--sidebar-fg: var(--fg); |
Suggested on discord, makes the sidebar items grey instead of orange by default
mdbook.theme = true
(or None) then wetheme
dir if it existsThe argument for doing these mutations to their project (instead of injecting them with the mdbook library API) is so that
mdbook build
on its own produces the same results. This is currently done on every build, so the user cannot hand-edit the result, as it will just be silently overwritten.