dsh-text-styles: Tagging Dialogue Text by Role

Introduction

The conversation in DeepSeek Harness (DSH) is essentially “a hodgepodge”: body text, captions, translations, code blocks, and tool outputs are all mixed together, with different types of content distinguished only by position and layout, making them easy to confuse. dsh-text-styles treats each role in the conversation as an independent target and lets you set styles separately—font, font size, line height, color, background, border, margins, and more—so that “body text, captions, translations, quotes, and code” are instantly distinguishable at a glance.

What It Is

This is a DSH plugin package (host half + browser half) responsible for rendering conversation text styles. It is the style-rendering portion extracted from the original dsh-text-manager, and is fully independent from dsh-text-translator (which handles translation). It can be installed, enabled, or updated on its own.

The plugin works by applying a single <style> rule to DSH’s own DOM contracts (e.g., data-chat-flow-kind, data-chat-group-part, data-chat-call-id, data-caption, class*="markdown", etc.). It does not modify text content and does not touch React nodes.

Supported Targets

The plugin supports 15 targets, covering the major text types in a conversation:

  • Main content: body text, caption, reasoning translation, caption translation, body translation
  • Emphasis & quotes: emphasis, blockquote, links
  • Structure: headings, lists
  • Code & commands: inline code, code blocks, command descriptions, tool outputs
  • Other: my messages

Each target offers 3–6 presets (e.g., compact, relaxed, large text, card, monospace, highlighter, vertical line), and provides nearly twenty fine-grained knobs:

  • Font / font size / line height / font weight / italic / letter spacing
  • Text color / opacity / alignment / background / border radius / underline
  • Left margin / right margin / vertical padding / vertical margin
  • Border toggle (none / left / right / top / bottom / all sides) with width, style (solid / dashed), and color

“Left margin” is a standalone item: body text has no built-in padding by default, so adding a left-border line causes text to hug the line. Bumping the left margin to 12–16px creates the needed breathing room.

Relationship with the Translation Plugin

The plugin and the translation plugin coordinate through DOM attribute conventions: translation blocks carry data-dsh-tm="block", data-kind (reasoning / prose), and data-dsh-tm-block-part. The plugin uses these to match the three targets: “reasoning translation / caption translation / body translation.”

  • Without the translation plugin installed, these three targets match nothing, and adjusting them has no side effects.
  • With the translation plugin installed, translations automatically receive the corresponding styles—no extra coordination needed.

Installation & Enabling

Install the plugin via npm:

npm install dsh-text-styles

After installation, simply enable the plugin in DSH.

Once enabled, navigate to Settings → Text Styles in the DSH settings page to access the style configuration UI.

Configuration

The plugin provides two configuration entry points:

  1. Settings page: Settings → Text Styles (settings.section, id text-styles).
  2. Settings file: <DSH_HOME>/text-styles/settings.json.

On first run, the plugin automatically migrates presets from the legacy <DSH_HOME>/text-manager/settings.json textStyle field, so previously tuned styles are preserved.

Visualization & Live Preview

  • Each preset label renders the actual CSS that preset generates, so you can see the effect of “compact / relaxed / large text / card / monospace / highlighter / vertical line” at a glance.
  • The settings page includes a full sample (user message → reasoning translation → caption → caption translation → body text → tool card) rendered with the same CSS used in real conversations.
  • “Apply to the current conversation immediately” is enabled by default: changes are written directly into the currently displayed conversation, and unsaved changes are not overwritten by background refreshes. If you leave the settings page without saving, the display reverts to the saved state.
  • Saved styles are applied automatically on page load—no need to open the settings page first.

Preview & Testing

  • Preview file: preview/text-style.html. The module’s own CSS generator produces a preset gallery showing six combinations side by side.
  • Regenerate the preview: node tools/make-style-preview.mjs <unpacked dsh-client-ui-theme directory>.
  • Run tests:
node test/style.test.mjs     # style catalog, presets & overrides, declaration generation, borders & margins, scoping, prose/caption markers, engine lifecycle
node test/settings.test.mjs  # settings page rendering, preset clicks, save via its own route

Known Limitations

  • Command descriptions / tool outputs rely on dsh-client-ui-tool’s data-caption, data-chat-call-id (stable attributes) and build-time hashed class names like _codeBody (substring matching). After a major DSH version upgrade, these two may no longer match, causing the corresponding targets to stop applying. Other content is unaffected.
  • Colors use theme tokens (or color-mix on tokens), so they remain correct after light/dark mode switching.

Use Cases & Notes

Ideal for developers and users who need to visually distinguish different text roles in a conversation, such as:
- Scenarios where you want to clearly differentiate body text, captions, and translations
- Scenarios with style requirements for code blocks, tool outputs, and quotes

Note: the plugin runs with the current DSH process’s permissions. Review the source code and license before installing.

In Short

By styling each role separately, every text type in a conversation becomes instantly identifiable. See the plugin directory page and the repository for more details.

Plugin directory page
GitHub repository

羽毛球分组比赛记分
小程序二维码

欢迎使用《羽毛球分组比赛记分》微信小程序

Xiaoye