You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
FIX: myst-nb 1.4+ compatibility, inline_literal_box option, and --qe-literal-color (#373)
* FIX: Set data-theme attribute on <html> for mystnb 1.4+ compatibility
myst-nb 1.4.0 (PR executablebooks/MyST-NB#693) changed its dark mode CSS
from html[data-theme="dark"] selectors to a CSS space-toggle technique
that falls back to @media (prefers-color-scheme) when no data-theme
attribute is present.
Since quantecon-book-theme uses body.dark-theme class (not data-theme)
for dark mode, mystnb never detects the theme mode and falls through to
the OS color scheme preference, causing dark code cell backgrounds on
light-themed sites for users with OS dark mode enabled.
Fix: Set data-theme="light" on <html> by default and toggle it to
data-theme="dark" when the contrast button is activated. This is the
standard mechanism used by pydata-sphinx-theme, Furo, and
sphinx-book-theme.
Closes#372
* UPDATE: Regenerate all visual snapshots (8 files)
* fix: override pydata-sphinx-theme .nf color rule activated by data-theme attribute
pydata-sphinx-theme has a rule scoped to html[data-theme=light] that sets
.highlight .nf color to #0078a1 with !important. This was dormant before we
set data-theme on <html>. It overrode our custom function name color (#06287e)
from _code.scss since :where() has zero specificity.
Add a counter-rule with higher specificity to preserve our custom highlighting
when qetheme_code_style is enabled.
* fix: increase specificity of custom highlighting to beat pydata's Pygments rules
pydata-sphinx-theme's overwrite_pygments_css scopes ALL Pygments rules to
html[data-theme="light"] and html[data-theme="dark"] at specificity (0,3,1).
Our :where() wrapper gave zero specificity, so setting data-theme activated
pydata's Pygments rules which overrode ALL our custom token colors.
Replace :where(body:not(.use-pygments-style)) with
html body:not(.use-pygments-style) which gives specificity (0,3,2),
beating pydata's (0,3,1). Applied to both _code.scss and _syntax.scss.
Remove the previous .nf-specific override since higher base specificity
now handles all tokens.
* UPDATE: Regenerate all visual snapshots (3 files)
* Add inline_literal_box option to control inline code box styling
Add configurable theme option (default: False) that controls whether
inline code elements (code.literal) show pydata-sphinx-theme's background
box and border styling. When False, the boxes are stripped to match the
theme's original look. Set inline_literal_box: True in html_theme_options
to re-enable the box styling.
* Document inline_literal_box option in code highlighting docs
* UPDATE: Regenerate all visual snapshots (4 files)
* Add --qe-literal-color to text color scheme system
Integrate inline code literal (code.literal) color into the color scheme
system alongside emphasis, strong, and definition colors:
- Seoul256: #af5f5f (muted rust) / #d78787 (soft rose dark)
- Gruvbox: #9d0006 (dark red) / #fb4934 (bright red dark)
- None: inherits text color
Overridable via --qe-literal-color CSS variable.
* Apply Copilot review: add contrast ratios and fix leading space in body class
---------
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
0 commit comments