Skip to content

fix(code): follow dark mode with Shiki's dark theme without typeset - #380

Merged
vite-hub[bot] merged 2 commits into
mainfrom
fix/code-dark-shiki
Nov 7, 2026
Merged

vite-hub[bot] merged 2 commits into
mainfrom
fix/code-dark-shiki

Conversation

@onmax

@onmax onmax commented Nov 7, 2026 •

Copy link
Copy Markdown
Owner

With typeset: false, code blocks stay on Shiki's light colors on a dark page. The rule that swaps in --shiki-dark only shipped in typeset.css, so a site that turns typeset off has to copy it, as @vite-hub/docs does with html.dark .shiki span { color: var(--shiki-dark) !important }.

This extracts the rule into shared/shiki.ts and bundles it into comark-code's styles and comark-diff's, since a diff's table draws Shiki's tokens without a code block. Typeset reuses the same rule inside its existing scope, preserving dark-mode switching for the standalone stylesheet and for shiki + typeset with code: false. It's the same rule as before: a .dark class above the code, or the system's dark mode with no .light class above it.

Before/after on Drop: the same fixture rendered with comark-ui/html on a dark page with typeset off. With typeset on, light and dark screenshots of the same fixture match main pixel for pixel.

The new tests in code.test.ts, diff.test.ts, and typeset-stylesheet.test.ts fail on main and pass here. pnpm ready passes.

One difference: the rule used to sit inside typeset's @scope, so it only reached code inside a document. Now it reaches any .shiki span on a page that loads comark-code's or comark-diff's styles.

The rule that swaps Shiki's inline light colors for `--shiki-dark` lived only
in the typeset styles, so a page with `typeset: false` kept light-theme code
on a dark page. It now ships in comark-code's styles, and in comark-diff's,
whose table draws Shiki's tokens without a code block. Typeset no longer
repeats it.
@chatgpt-codex-connector

Copy link
Copy Markdown
Codex Review Summary: ❌ Failed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ❌ Failed 2026-11-07T11:28:25.870491Z
We couldn’t complete this review. Comment @codex review to try again.
28e33d7 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Important

Moving the Shiki override entirely out of typeset regresses typeset-only consumers that do not load comark-code styles.

Reviewed changes in 28e33d7: the extraction of Shiki dark-mode selectors into a shared helper, their inclusion in code and diff styles, the removal from typeset CSS, and the related documentation and tests.

  • Shared Shiki override — adds one minified helper for color, font style, and font weight under explicit or system dark mode.
  • Code and diff ownership — bundles that override into comark-code and comark-diff so they switch themes when typeset is disabled.
  • Typeset removal — removes the previous scoped selectors and updates the stylesheet assertion to require their absence.
  • Documentation — describes the new code-owned behavior for code blocks, diffs, and typeset.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using gpt-5.6-sol | 𝕏

Comment thread packages/ui/src/typeset-css.ts Resolved
@pkg-pr-new

pkg-pr-new Bot commented Nov 7, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

comark-annotate

pnpm add https://pkg.pr.new/comark-annotate@380

comark-badge

pnpm add https://pkg.pr.new/comark-badge@380

comark-cards

pnpm add https://pkg.pr.new/comark-cards@380

comark-carousel

pnpm add https://pkg.pr.new/comark-carousel@380

comark-cast

pnpm add https://pkg.pr.new/comark-cast@380

comark-charts

pnpm add https://pkg.pr.new/comark-charts@380

comark-chat

pnpm add https://pkg.pr.new/comark-chat@380

comark-chips

pnpm add https://pkg.pr.new/comark-chips@380

comark-cjk

pnpm add https://pkg.pr.new/comark-cjk@380

comark-code

pnpm add https://pkg.pr.new/comark-code@380

comark-code-notes

pnpm add https://pkg.pr.new/comark-code-notes@380

comark-colors

pnpm add https://pkg.pr.new/comark-colors@380

comark-comments

pnpm add https://pkg.pr.new/comark-comments@380

comark-critic

pnpm add https://pkg.pr.new/comark-critic@380

comark-deflist

pnpm add https://pkg.pr.new/comark-deflist@380

comark-details

pnpm add https://pkg.pr.new/comark-details@380

comark-diagrams

pnpm add https://pkg.pr.new/comark-diagrams@380

comark-diff

pnpm add https://pkg.pr.new/comark-diff@380

comark-embed

pnpm add https://pkg.pr.new/comark-embed@380

comark-fields

pnpm add https://pkg.pr.new/comark-fields@380

comark-figure

pnpm add https://pkg.pr.new/comark-figure@380

comark-file-tree

pnpm add https://pkg.pr.new/comark-file-tree@380

comark-footnotes

pnpm add https://pkg.pr.new/comark-footnotes@380

comark-github

pnpm add https://pkg.pr.new/comark-github@380

comark-icon

pnpm add https://pkg.pr.new/comark-icon@380

comark-include

pnpm add https://pkg.pr.new/comark-include@380

comark-keys

pnpm add https://pkg.pr.new/comark-keys@380

comark-links

pnpm add https://pkg.pr.new/comark-links@380

comark-linter

pnpm add https://pkg.pr.new/comark-linter@380

comark-magic-move

pnpm add https://pkg.pr.new/comark-magic-move@380

comark-mark

pnpm add https://pkg.pr.new/comark-mark@380

markdown-it-to-comark

pnpm add https://pkg.pr.new/markdown-it-to-comark@380

marked-to-comark

pnpm add https://pkg.pr.new/marked-to-comark@380

comark-mathml

pnpm add https://pkg.pr.new/comark-mathml@380

comark-media

pnpm add https://pkg.pr.new/comark-media@380

comark-metrics

pnpm add https://pkg.pr.new/comark-metrics@380

migrate-to-comark

pnpm add https://pkg.pr.new/migrate-to-comark@380

comark-outline

pnpm add https://pkg.pr.new/comark-outline@380

comark-properties

pnpm add https://pkg.pr.new/comark-properties@380

comark-qr

pnpm add https://pkg.pr.new/comark-qr@380

comark-quiz

pnpm add https://pkg.pr.new/comark-quiz@380

comark-reading-time

pnpm add https://pkg.pr.new/comark-reading-time@380

remark-to-comark

pnpm add https://pkg.pr.new/remark-to-comark@380

comark-sources

pnpm add https://pkg.pr.new/comark-sources@380

comark-steps

pnpm add https://pkg.pr.new/comark-steps@380

comark-table

pnpm add https://pkg.pr.new/comark-table@380

comark-tabs

pnpm add https://pkg.pr.new/comark-tabs@380

comark-tests

pnpm add https://pkg.pr.new/comark-tests@380

comark-time

pnpm add https://pkg.pr.new/comark-time@380

comark-ui

pnpm add https://pkg.pr.new/comark-ui@380

comark-xref

pnpm add https://pkg.pr.new/comark-xref@380

comark-zoom

pnpm add https://pkg.pr.new/comark-zoom@380

commit: fe0b1f1

@vite-hub

vite-hub Bot commented Nov 7, 2026 •

Copy link
Copy Markdown
Contributor
Session Status Started Duration
Pending Completed Not started —
View session Completed 2026-11-07T12:25:22.549Z 15m 52s

Latest result

Pull request merged.

Final answers

Session

Pull request merged.

View session

Pushed fe0b1f1, fixing Pullfrog P1: typeset-only Shiki dark themes. Added regression coverage, updated docs, and resolved the thread. Diff-package `vp test test/diff.test.ts`: 21 passed. Stylesheet assertions, focused lint, formatting, and source typecheck passed. UI tests require unbuilt workspace packages; browser verification lacked Chromium. Awaiting hosted checks.

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No new issues found.

Reviewed changes since the prior Pullfrog review: the follow-up restores dark-theme switching for typeset-only consumers while retaining the original fix for code and diff styles.

  • Typeset ownership — reused shikiDark inside typeset's existing @scope, preserving the standalone stylesheet and shiki with code: false paths.
  • Regression coverage — added assertions for explicit and system dark-mode selectors in the standalone stylesheet and for highlighted plain pre output without comark-code.
  • Documentation — clarified that both typeset and code styles carry the Shiki theme-switching rule.

Pullfrog  | View workflow run | Using gpt-5.6-sol | 𝕏

@vite-hub
vite-hub Bot merged commit 07076f5 into main Nov 7, 2026
6 checks passed
@vite-hub
vite-hub Bot deleted the fix/code-dark-shiki branch November 7, 2026 13:04
@github-actions github-actions Bot mentioned this pull request Nov 7, 2026
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