kaxil opened a new pull request, #1507: URL: https://github.com/apache/airflow-site/pull/1507
PR #1421 introduced two issues with code block syntax highlighting in Sphinx docs: **Before**: <img width="1129" height="395" alt="image" src="https://github.com/user-attachments/assets/26ad73e2-fd0a-4cea-acd2-30a25a4504a5" /> <img width="1117" height="360" alt="image" src="https://github.com/user-attachments/assets/af7cf1c1-064f-4f3b-9e8d-c3141088f07f" /> **After**: <img width="1116" height="336" alt="image" src="https://github.com/user-attachments/assets/e2abc165-86f1-42ba-bc58-9c81c60f786f" /> <img width="1106" height="329" alt="image" src="https://github.com/user-attachments/assets/a9c3bc21-0dcc-4f7d-b7b6-aa05dfad19f8" /> --- 1. Replaced `pre span { @extend .monotext--brownish-grey }` with `pre span { color: var(--bs-body-color) }` — a blanket rule that broke CSS inheritance for Pygments tokens without explicit class rules (they got `--bs-body-color` instead of inheriting from `.highlight`'s theme-specific default color) 2. Removed `.nn` (Name.Namespace) from the dark Pygments theme, causing module paths in imports to lose their styling ## Changes - **Remove `pre span { color }` rule** (`_highlights.scss`) — tokens without specific Pygments rules now properly inherit from `.highlight { color: ... }` via the CSS cascade - **Add `.nn` override in both themes** (`_dark.scss`, `_light.scss`) — renders namespace tokens (module paths like `airflow.sdk` in imports) as plain text color instead of keyword-colored, matching how GitHub.com actually renders Python. Also sets `font-weight: normal` to counteract Sphinx's auto-generated `pygments.css` which makes `.nn` bold - **Add default text `color` to `.highlight` in light theme** (`_light.scss`) — provides a stable inherited color for unclassed tokens - **Remove duplicate `@import "pygments/dark"`** (`_rst-content.scss`) — was imported in both `_highlights.scss` and `_rst-content.scss`, producing dead double-nested CSS selectors that never matched real HTML ## Design rationale Sphinx auto-generates a `pygments.css` from `pygments_style = default` in `theme.conf`. This provides baseline token coverage at specificity `0,2,0`. Our custom SCSS rules are scoped under `[data-bs-theme="..."] .rst-content` giving them specificity `0,4,0`, so they cleanly override `pygments.css` where needed. The `.nn` override is necessary because Sphinx's default theme colors namespaces blue+bold, while GitHub.com renders them as plain text — without the explicit override, `pygments.css` would take effect. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
