Skip to content

fix(css): restore Shiki color mapping for CDS code blocks (#1657) - #1666

Merged
jung-thomas merged 1 commit into
mainfrom
worktree-fix-1657-shiki-css
Aug 11, 2026
Merged

fix(css): restore Shiki color mapping for CDS code blocks (#1657)#1666
jung-thomas merged 1 commit into
mainfrom
worktree-fix-1657-shiki-css

Conversation

@jung-thomas

Copy link
Copy Markdown
Contributor

Follow-up to #1661 for #1657.

Why a second PR

#1661 fixed the pipeline — DEV now serves correct Shiki markup (298 shiki spans, 0 language-sql, the red err braces are gone). But the CDS blocks still render as uncoloured text.

Root cause

scripts/highlight-cds.ts emits Shiki with defaultColor: false, so each token span carries only --shiki-light / --shiki-dark CSS variables and no color. Painting them requires a supporting rule:

.shiki span { color: var(--shiki-light); }
html.dark .shiki span { color: var(--shiki-dark); }

That block existed in the original CDS-highlighting commit (7b66dfba) but was removed in a9d94110 ("approuter local dev and content-serve improvements") when the static sap-fundamental.css was cleaned up. Nothing has coloured the spans since — hence "we had this working in the past."

Fix

Restore the .shiki color mapping in the source hugo/assets/css/sap-fundamental.src.css (so build:css bakes it into the served, fingerprinted stylesheet — the static file it originally lived in no longer exists), and rebuild sap-fundamental.css. Dark selectors cover both html.dark and [data-theme="dark"] (the toggle sets both in lockstep, per head.html).

Scope

CSS-only. Ships with a normal MTA deploy (approuter static) — no content rebuild needed; the Shiki HTML is already correct in HANA.

Verification

Loaded the real served Shiki markup with the new CSS in a browser and read computed token colours:

  • Light: keyword rgb(215,58,73) (#D73A49), punctuation rgb(36,41,46) (#24292E)
  • Dark: keyword rgb(249,117,131) (#F97583), punctuation rgb(225,228,232) (#E1E4E8)

The pipeline fix (#1661) got correct Shiki markup live, but tokens rendered
uncoloured: highlight-cds.ts uses defaultColor:false, so each span carries only
--shiki-light/--shiki-dark CSS variables and no `color`. The rules that paint
those variables were dropped in a9d9411 (static sap-fundamental.css cleanup),
so there was nothing to colour the spans.

Restore the .shiki color mapping in the SOURCE sap-fundamental.src.css (light +
html.dark/[data-theme=dark]) and rebuild sap-fundamental.css. CSS-only — ships
with a normal deploy; no content rebuild needed (Shiki HTML already in HANA).

Verified computed token colours resolve in both themes (light #D73A49 keyword /
dark #F97583; punctuation #24292E / #E1E4E8).
@jung-thomas
jung-thomas merged commit 3271988 into main Aug 11, 2026
2 of 3 checks passed
@jung-thomas
jung-thomas deleted the worktree-fix-1657-shiki-css branch August 11, 2026 21:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant