Skip to content

text: Support list and blockquote style overrides - #3687

Merged
huacnlee merged 2 commits into
longbridge:mainfrom
citizenhicks:text-markdown-marker-styles
Oct 26, 2026
Merged

huacnlee merged 2 commits into
longbridge:mainfrom
citizenhicks:text-markdown-marker-styles

Conversation

@citizenhicks

@citizenhicks citizenhicks commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

Description

Add list_style(StyleRefinement) and blockquote_style(StyleRefinement) overrides to TextView, following inline_code_style from #3663. Each refinement applies after the resolved theme or explicit style and surface-color adaptation; unspecified properties keep the existing defaults, and explicit refinements stay unchanged on inverted surfaces.

  • The list marker refinement applies to the bullet or number column of each list item, over its defaults (muted text color, list-indent minimum width, right-aligned text, 0.3-indent right padding). Its text color also outlines unchecked task-list checkboxes; checked ones keep the link color.
  • The blockquote refinement applies to the quote container, over its defaults (muted text color, 2px left border in the border color, 0.9-body-size left padding). Border widths and color style the quote bar; text, background, padding, and corner radii style the quote and its contents.

Defaults are empty refinements, so rendering is unchanged unless an override is set. Code blocks, tables, rules, and done tasks keep the shared muted_foreground and border colors. The public Component TextViewStyle fields are unchanged. English and Chinese Base and Component docs describe both overrides.

Example

use gpui_kit::{StyleRefinement, Styled as _};
use gpui_kit::component::{ActiveTheme as _, text::TextView};

TextView::markdown("notes", "1. First\n2. Second\n\n> Quoted")
    .list_style(StyleRefinement::default().text_color(cx.theme().primary))
    .blockquote_style(StyleRefinement::default().border_color(cx.theme().primary))

Public API

gpui-base

  • TextViewStyle::with_list_style(self, style: StyleRefinement) -> Self — Set explicit list refinements.
  • TextViewStyle::list_style(&self) -> &StyleRefinement — Read the explicit list refinement.
  • TextViewStyle::with_blockquote_style(self, style: StyleRefinement) -> Self — Set explicit blockquote refinements.
  • TextViewStyle::blockquote_style(&self) -> &StyleRefinement — Read the explicit blockquote refinement.
  • TextView::list_style(self, style: StyleRefinement) -> Self — Refine list markers over the resolved style.
  • TextView::blockquote_style(self, style: StyleRefinement) -> Self — Refine blockquotes over the resolved style.

gpui-component

  • text::TextView::list_style(self, style: StyleRefinement) -> Self — Apply the list override through the Component facade.
  • text::TextView::blockquote_style(self, style: StyleRefinement) -> Self — Apply the blockquote override through the Component facade.

Breaking Changes

None. The additions are new builders and readers; existing APIs, defaults, and public Component style fields are unchanged.

The list API is named after the Markdown List block; its rendering scope is described above.

How to Test

  • cargo test -p gpui-base --features test-support --lib text:: — covers the empty defaults, builders, style equality, refinements kept on an inverted surface, and a render test that the view-level refinements keep properties set on the global TextViewDefaults style. A renderer regression checks that nested table columns are measured with the blockquote's font family and weight.
  • cargo test -p gpui-component --features test-support text
  • cargo clippy -p gpui-base -p gpui-component --locked -- --deny warnings
  • cargo fmt --check -p gpui-base -p gpui-component
  • Manual: render Markdown with an ordered list, a bullet list, a task list, and a blockquote, and set list_style(StyleRefinement::default().text_color(..)) and blockquote_style(StyleRefinement::default().border_color(..)). Only the markers, unchecked checkbox outlines, and the quote bar change color.

Validation: targeted text tests passed (400 Base and 69 Component). Clippy with warnings denied, package formatting, and git diff --check passed. Manual visual and cross-platform checks were not run.

Rename validation: Base and Component test targets compiled with cargo check -p gpui-base -p gpui-component --features gpui-base/test-support,gpui-component/test-support --tests --locked. cargo fmt --all --check and git diff --check passed. No tests were rerun for the naming-only revision. The rename, documentation updates, and compilation checks were AI-assisted.

Checklist

  • I have read the CONTRIBUTING document and followed the guidelines.
  • Reviewed the changes in this PR and confirmed AI generated code (If any) is accurate.
  • Passed cargo run for story tests related to the changes.
  • Tested macOS, Windows and Linux platforms performance (if the change is platform-specific)

Implementation, tests, and documentation were generated with AI assistance and reviewed by the author.

@citizenhicks
citizenhicks marked this pull request as ready for review October 25, 2026 11:51
Rename list_marker_style to list_style, including the Base style builder and reader, Component facade, tests and both documentation locales. Preserve rendering behavior.

AI-assisted rename and validation.
@huacnlee huacnlee changed the title text: Support list marker and blockquote style overrides text: Support list and blockquote style overrides Oct 26, 2026
@huacnlee
huacnlee merged commit b4af12b into longbridge:main Oct 26, 2026
19 checks passed
@citizenhicks
citizenhicks deleted the text-markdown-marker-styles branch October 26, 2026 06: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.

2 participants