-
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
axomdbook #339
Merged
Merged
axomdbook #339
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
alright, did a bunch of work on this and it's looking a lot better. Some issues:
|
wait what |
shadows-withal
approved these changes
May 30, 2023
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.
looking good, i think this can be merged after reverting the web.yml change and squashing
This adds oranda-css/mdbook-theme which is vendored into the oranda binary at build time. If mdbook.theme = true is set (the default, you need to opt out), we will override your mdbook theme with our own, adding "axo" and "axo-light" themes which match the default oranda light/dark themes. The existing builtin mdbook themes should remain and behave the same, and can still be selected. We do not modify the source of your mdbook -- we generate a new temp theme dir in oranda's output dir (./public/) and tell mdbook to use that as the theme. These themes are currently hardcoded, but use the same css-variable machinery that mdbook is built around. As such they are primarily defined by a set of values in variables.css that can easily be updated in the future. Note that as a result of this, running 'mdbook build' on its own will now produce different results from having oranda run it. In the future we will probably expose a "vendor" option that modifies your tree so that vanilla mdbook theme runs produce the same results (that was actually the original implementation, but we felt this was less intrusive/surprising as a default). Some changes made to the default mdbook theme files: * To avoid issues with running other mdbook instances (or toggling this on/off), we change the default "mdbook-theme" localStorage key to "axomdbook-theme". This prevents vanilla instances of mdbook from seeing that you have selected "axo" as a theme, which would otherwise cause those instances to crash due to a failed lookup of that name. * A new highlightjs stylesheet, axoHighlight, has been added to book.js and index.hbs. Because mdbook doesn't really support adding extra stylesheets (only overloading the "main" one, which would clash with the default mdbook themes), we inject this stylesheet by just copying it into the final mdbook output after mdbook has run. axoHighlight is currently base16/material.css, which is stored in-tree as `oranda-css/mdbook-theme/highlight-js-themes/base16-material.css`. It is selected using your oranda syntax highlighting theme, but that feature was already limited to one value. * To avoid issues with adding new highlightjs stylesheets, we now disable all of them in a loop whenever a theme is selected, so each case only needs to be responsible for enabling itself, and doesn't need to enumerate all the other ones that need to be disabled. * A few edits were made to the css to add more distinctions-via-variables, like allowing "main titles" to be styled differently from other headings, and allowing themes to select the font. * axo/axo-light are hardcoded in the css to disable padding/bg-color-changes to inline code snippets, as this is the style we use in oranda. I couldn't find a way to make this controlled by variables, as this is specifically shadowing values set by the currently enabled highlightjs stylesheet, and there's no way to "disable" a css rule with just variables (that I know). * fonts.css was changed to import axo's preferred fonts instead of the builtin ones. I'm a bit fuzzy on whether the vendored fonts are unvendored by this, because this behaviour was recently being changed in mdbook.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This adds
./oranda-css/mdbook-theme/
which is vendored into the oranda binaryat build time. If mdbook.theme = true is set (the default, you need to opt out),
we will override your mdbook theme with our own, adding "axo" and "axo-light"
themes which match the default oranda light/dark themes.
The existing builtin mdbook themes should remain and behave the same, and can
still be selected.
We do not modify the source of your mdbook -- we generate a new temp theme dir
in oranda's output dir (./public/) and tell mdbook to use that as the theme.
These themes are currently hardcoded, but use the same css-variable machinery
that mdbook is built around. As such they are primarily defined by a set of
values in variables.css that can easily be updated in the future.
Note that as a result of this, running 'mdbook build' on its own will now
produce different results from having oranda run it. In the future we will
probably expose a "vendor" option that modifies your tree so that vanilla
mdbook theme runs produce the same results (that was actually the original
implementation, but we felt this was less intrusive/surprising as a default).
Some changes made to the default mdbook theme files:
To avoid issues with running other mdbook instances (or toggling this on/off),
we change the default "mdbook-theme" localStorage key to "axomdbook-theme".
This prevents vanilla instances of mdbook from seeing that you have selected
"axo" as a theme, which would otherwise cause those instances to crash due to
a failed lookup of that name.
A new highlightjs stylesheet, axoHighlight, has been added to book.js and
index.hbs. Because mdbook doesn't really support adding extra stylesheets
(only overloading the "main" one, which would clash with the default mdbook
themes), we inject this stylesheet by just copying it into the final mdbook
output after mdbook has run. axoHighlight is currently base16/material.css,
which is stored in-tree as
oranda-css/mdbook-theme/highlight-js-themes/base16-material.css
. It isselected using your oranda syntax highlighting theme, but that feature was
already limited to one value.
To avoid issues with adding new highlightjs stylesheets, we now disable all
of them in a loop whenever a theme is selected, so each case only needs to be
responsible for enabling itself, and doesn't need to enumerate all the other
ones that need to be disabled.
A few edits were made to the css to add more distinctions-via-variables,
like allowing "main titles" to be styled differently from other headings,
and allowing themes to select the font.
axo/axo-light are hardcoded in the css to disable padding/bg-color-changes
to inline code snippets, as this is the style we use in oranda. I couldn't
find a way to make this controlled by variables, as this is specifically
shadowing values set by the currently enabled highlightjs stylesheet, and
there's no way to "disable" a css rule with just variables (that I know).
fonts.css was changed to import axo's preferred fonts instead of the
builtin ones. I'm a bit fuzzy on whether the vendored fonts are unvendored
by this, because this behaviour was recently being changed in mdbook.