Skip to content

feat(chat): add theme-aware Markdown style presets - #4821

Merged
devswha merged 5 commits into
mainfrom
feat/chat-markdown-styles
Nov 26, 2026
Merged

devswha merged 5 commits into
mainfrom
feat/chat-markdown-styles

Conversation

@devswha

@devswha devswha commented Nov 26, 2026

Copy link
Copy Markdown
Owner

Change

Add a theme-like Chat Markdown preset picker under Settings → Appearance (right below the Theme card strip) so assistant Markdown replies can use theme-aware typography and color presets instead of a single monochrome style or a binary toggle.

Four presets are selectable from a miniature-preview card strip (role="radiogroup", arrow/Home/End navigation, reset button), defaulting to Editorial:

  • Editorial (editorial, default) — restrained Claude/Linear-style hierarchy: neutral strong headings with a hairline divider under h2, subtle single-accent tints on list markers, blockquote rail/wash, and non-file inline code pills, plus an elevated table header.
  • Tinted (tinted) — soft two-tone theme tint across headings, blockquotes, and inline code.
  • Colorful (colorful) — syntax-colored Markdown roles driven by the active theme's --syntax-* tokens (building on the direction proposed in feat(chat): add theme-aware Markdown colors #4262).
  • Plain (plain) — preserves the original monochrome Markdown rendering unchanged.

Key details

  • Scoped to assistant replies only (.chat-turn-agent .markdown): user bubbles, file previews, fenced code syntax highlighting, and clickable file/link chips (.markdown-file, .markdown-code-link, a > code) keep their existing affordances and hover/focus states.
  • Zero-FOUC boot & safe storage: persisted under its own ovis:markdown-style key (read in src/theme-bootstrap.ts before React mounts, synced across tabs via StorageEvent, and never clobbered by older tabs rewriting ovis:settings).
  • Cross-device sync: added "markdownStyle" to SHARED_SETTING_KEYS in shared/preferences.ts.
  • Theme token & contrast safety: 100% existing CSS tokens and color-mix() (no color literals or !important), with automated WCAG AA (>= 4.5:1) contrast tests covering all 25 built-in dark and light themes across editorial, tinted, and colorful (src/lib/themes.contrast.test.ts).
  • i18n, docs & changelog: added Korean, Japanese, and Simplified Chinese settings translations, documented markdownStyle in DESIGN.md, and added changelog.d/chat-markdown-styles.md.

Screenshots (real Ovis demo, 1280px dark & light)

Settings → Appearance → Chat Markdown

Dark Light
Settings Dark Settings Light

Editorial (default)

Dark Light
Editorial Dark Editorial Light

Tinted

Dark Light
Tinted Dark Tinted Light

Colorful

Dark Light
Colorful Dark Colorful Light

Plain (before / monochrome baseline)

Dark Light
Plain Dark Plain Light

Validation

  • bun run check fast: pass (workflow syntax, generate:types --check, generate:themes --check, typecheck, build, and unit: 28,771 pass, 0 fail, 259 skip across 1,349 files).
    • Includes new WCAG AA (>= 4.5:1) contrast assertions across all 25 built-in themes × all styled presets in src/lib/themes.contrast.test.ts, storage/scope/legacy-tab survival tests in src/lib/settings.test.ts, and cold-boot parity in src/lib/themeBoot.test.ts.
  • Built demo browser verification (1280px dark & light): verified default data-markdown-style="editorial", live switching across all 4 cards, localStorage["ovis:markdown-style"] persistence across reload, and clickable file chip preservation.
  • Skipped locally: bun run test:integration / bun run test:ui (covered by CI).

@coderabbitai

coderabbitai Bot commented Nov 26, 2026 •

Copy link
Copy Markdown

Explain Change →

Important

Review skipped

Auto incremental reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

Run configuration

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review

No actionable comments were generated in the recent review.

Summary

Summary by CodeRabbit

  • New Features
    • Added a Chat appearance setting for assistant Markdown replies, with Editorial (default), Tinted, Colorful, and Plain styles.
    • The selected style syncs across devices and adapts to the active theme. It changes Markdown elements such as headings, quotes, and tables while keeping file chips and previews unchanged.
    • Style choices are available in the Appearance settings, with keyboard navigation support.

Adds a shared Chat Markdown style setting with Editorial, Tinted, Colorful, and Plain options. The setting persists across sessions and syncs across devices. An Appearance picker selects the style, which controls assistant-reply Markdown styling.

Changes: Chat Markdown styles

Layer / File(s) Summary
Setting persistence and cold-boot application
src/lib/themeBoot.ts, src/lib/settings.ts, shared/preferences.ts, src/theme-bootstrap.ts, src/lib/*test.ts
Adds the style values, default, validation, dedicated storage key, shared-setting scope, and document application. Tests cover storage, invalid values, and preference sync.
Appearance picker and selection illustration
src/components/SettingsDialog.tsx, src/components/SettingsControls.css, src/lib/i18n/settings.*.ts, scripts/settings-rows-demo-regression.ts
Adds a four-option radio-card picker with keyboard navigation, its illustration styles and translations, and waits for theme cards in the settings regression script.
Assistant Markdown styles and contrast checks
src/components/ChatView.css, src/lib/themes.contrast.test.ts, DESIGN.md, changelog.d/chat-markdown-styles.md
Adds Editorial, Tinted, and Colorful assistant Markdown styling. Contrast tests check built-in themes and a custom gray theme. Documentation describes the choices and scope.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Feature

Possibly related issues

  • devswha/ovis#4131: The PR adds shared-setting sync coverage for markdownStyle in the same sync path. The issue’s unrendered-edit race is not shown to be fixed.
  • devswha/ovis#3261: The PR tests client-side handling of a newer server value for markdownStyle. It does not add the server-side revision precondition described in the issue.

Possibly related PRs

  • devswha/ovis#4262: Both PRs change assistant-chat Markdown color rules in ChatView.css; their styling changes overlap.

Suggested reviewers: jpcarranza94

Merge Risk: Minimal · previous review eec01

This adds a Chat Markdown style picker with a persisted, shared setting. No concrete merge-blocking defect was found. The author reports a few minor known polish issues, and the full browser suite was not run.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title "feat(chat): add theme-aware Markdown style presets" names the main change: a Chat Markdown style picker with four presets (Editorial, Tinted, Colorful, Plain) that style assistant replies. …
Description check Passed The description follows the template. The Change section explains the problem and behavior, and it links the PR's design context. It does not link an issue where a maintainer agreed to the feature, wh…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title "feat(chat): add theme-aware Markdown style presets" names the main change: a Chat Markdown style picker with four presets (Editorial, Tinted, Colorful, Plain) that style assistant replies. It is specific and matches the raw summary, the objectives, and the changed files.

Full details: Description check

Explanation

The description follows the template. The Change section explains the problem and behavior, and it links the PR's design context. It does not link an issue where a maintainer agreed to the feature, which the template asks for. The Validation section lists the checks run (bun run check fast with results) and the skipped checks (test:integration, test:ui). It does not include contract-test coverage for HTTP/WS changes, although the change adds a shared setting key and a sync path. The description also includes a changelog reference, as the template's header comment requires.

Resolution

Optionally link the maintainer-agreed issue in the Change section. State whether the shared-setting sync change needs contract-test coverage, or explain why it does not.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 60797c2 and eec0172.

Files selected for processing: 18

  • DESIGN.md
  • changelog.d/chat-markdown-styles.md
  • scripts/settings-rows-demo-regression.ts
  • shared/preferences.ts
  • src/components/ChatView.css
  • src/components/SettingsControls.css
  • src/components/SettingsDialog.tsx
  • src/lib/i18n/settings.ja.ts
  • src/lib/i18n/settings.ko.ts
  • src/lib/i18n/settings.zh.ts
  • src/lib/preferencesSync.hook.test.ts
  • src/lib/settings.legacy-fixture.ts
  • src/lib/settings.test.ts
  • src/lib/settings.ts
  • src/lib/themeBoot.test.ts
  • src/lib/themeBoot.ts
  • src/lib/themes.contrast.test.ts
  • src/theme-bootstrap.ts

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 1 remain after this review.

- A tab no longer takes another tab's Chat Markdown pick from storage: that skipped the sync
  baseline, so a tab that missed the pick sent it back over a newer one from another device.
  The style follows the server's document, as the theme does.
- Editorial: ordered-list numbers keep the text color (only bullets are tinted), a nested quote
  gets one wash instead of one per level, and inline code is drawn in --text-strong instead of a
  mix of two text colors that an imported theme can put on either side of its ground.
- The contrast test reads the inline code and list marker colors from ChatView.css and covers an
  imported theme; settings-rows-demo-regression waits for the theme cards, not every card strip.
@devswha
devswha merged commit 3a74c8c into main Nov 26, 2026
22 checks passed
@devswha

devswha commented Nov 26, 2026

Copy link
Copy Markdown
Owner Author

Merged through pr-merge at head 9a63ee92f. Seen before the merge was asked for: required checks green, no unresolved thread, no conflict, no hold, main not red, no release in progress. CodeRabbit said it did not review (a limit or a skip) since this head.

main had moved since the checks of 2c264dcc1: pr-merge --update merged it in (21669a8fc), and every required check was green at this head.

Reviews: omo gate review and Codex (gpt-6.2-sol-fast, xhigh) on 6b94f89, both BLOCK on the same 4 reproduced MEDIUMs, all fixed in eec0172 with tests that fail on the old head; CodeRabbit reviewed eec0172 (no actionable comments). Merged on the owner's word via Dori lane pr-4821 ("4821 도 진행시켜놔").

@devswha
devswha deleted the feat/chat-markdown-styles branch November 26, 2026 16:04
devswha added a commit that referenced this pull request Nov 26, 2026
…dom page

#4821 added a test that dispatches a storage event through the old hand-made page
stub; it now dispatches a real StorageEvent on the page's window.
@devswha

devswha commented Nov 27, 2026

Copy link
Copy Markdown
Owner Author

Reposted with a private address removed; originally posted by @devswha on 2026-11-26.

Review pass and fixes (eec0172)

Before/after screenshots (demo build, light themes Codex / Catppuccin Latte / Solarized Light, desktop 1280 and phone 390, all four presets, and the new Settings row): (shared privately with the maintainer). Since editorial is the new default, every user's assistant replies change on update; plain keeps the old look.

Reviews on 6b94f89: omo gate review and Codex (gpt-6.2-sol-fast, xhigh), one each. Both said BLOCK and named the same four reproduced MEDIUMs. All four are fixed in eec0172:

Finding Fix
A tab that missed a pick through the event stream took it from another tab's storage write without moving its sync baseline. It then sent that older value back over a newer one from another device. markdownStyle no longer comes in through the storage listener; it follows the server's document, as theme does. New test in preferencesSync.hook.test.ts: it fails on 6b94f89 ("tinted" sent back over "colorful") and passes now.
Editorial ordered-list numbers were below 4.5:1 on Tokyo Night Day (4.01), Solarized Light (4.10) and Rosé Pine Dawn (4.24). Nested quotes stacked one 4% wash per level, down to 3.5:1 at depth 5 (Editorial and Tinted). Only bullets take the accent tint; ordered numbers keep the text color. A nested quote gets no extra wash. The test now covers Tinted list numbers.
A valid imported theme (gray ground, white text, black function color) drew Editorial inline code at 2.75:1 (Plain: 4.61:1). Editorial inline code uses --text-strong instead of a mix of two text colors (5.17:1 on that theme). The contrast test reads that color from ChatView.css and covers the imported theme; it fails on 6b94f89.
settings-rows-demo-regression failed twice: .theme-cards matched both the theme strip and the new Markdown strip (strict locator). The script waits for .theme-cards:has([data-theme-card]).

LOW findings, left as they are (reproduced by the reviewers; not follow-up issues):

  • A file or web link whose code sits inside *…* or **…** (.markdown-file > em > code) gets the preset's code pill, because the exclusion only checks the direct parent.
  • Restore defaults on the Chat Markdown row drops keyboard focus to body: the radios are siblings of the row, not inside it.
  • Searching Settings for "dark theme" leaves the Markdown card strip visible without its label row.

Validation

  • bun run check fast on eec0172: all steps ok (28778 pass, 0 fail).
  • In the CI runner image (herdr-ci-runner:local), on 6b94f89: 25 chat, settings and theme browser scripts, 24 passed. settings-rows-demo-regression failed (fixed above). On eec0172: settings-rows, settings-pages, settings-palette-search, theme-file, chat-list-markers, chat-select-quote and markdown-outline all passed (7/7).
  • themes.contrast.test.ts (WCAG AA for every built-in theme and preset, plus the imported case): 77 pass.
  • Not run here: the full browser suite (CI runs it).

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