Skip to content
Components

Markdown

Rendered agent markdown (GFM) whose code fences compose Code, and diff fences compose CodeDiff.

Composition

Rendered markdown

Pass the source in content. MarkdownRoot supplies tokens; MarkdownFlow owns block spacing.

  • <Markdown>
    • <MarkdownRoot>
      • <MarkdownFlow>
        • rendered prose and code fences
        </MarkdownFlow>
      </MarkdownRoot>
    </Markdown>

Custom prose

Compose MDX or Markdown parts inside MarkdownFlow, imported from ui/markdown-elements, which loads no optional peer: no Streamdown, Shiki, or virtualizer. Fenced code blocks and the full component map live in ui/markdown-components. MarkdownRoot carries the skin's markdown knobs; a part rendered outside it falls back to the neutral defaults. Re-value --cui-markdown-flow-gap and --cui-markdown-heading-gap on MarkdownRoot.

  • <MarkdownRoot>
    • <MarkdownFlow>
      • consumer-rendered prose
      </MarkdownFlow>
    </MarkdownRoot>

Installation

The Control UI source installs this component from src/registry/sources/control-ui/ui/markdown.tsx.

Registry command
See registry manifest

Dependencies

Fenced code renderer and the full component mapsrc/registry/sources/control-ui/ui/markdown-components.tsxSupport
Markdown root and prose parts, without optional peerssrc/registry/sources/control-ui/ui/markdown-elements.tsxSupport
Diff enginesrc/registry/lib/diff.tsSupport
Shiki tokenizersrc/registry/lib/code-tokens.tsSupport
Code + diff tokenssrc/registry/sources/control-ui/code.cssSupport
CheckboxcheckboxComponentCodecodeComponentCode Diffcode-diffComponentScroll areascroll-areaComponentTypographytypographyComponent

Raw code

Primary installed source

src/registry/sources/control-ui/ui/markdown.tsx

Knobs

Typed custom properties the recipe paints with. Set one on the root — style, a utility class, or a skin — and every slot inherits it.

--cui-markdown-* · 14 knobsHow the cascade resolves
--cui-markdown-foreground<color>oklch(from var(--foreground) l c h / 0.9)
--cui-markdown-blockquote-border-color<color>var(--border)
--cui-markdown-blockquote-foreground<color>var(--muted-foreground)
--cui-markdown-inline-code-background<color>oklch(from var(--foreground) l c h / 0.08)
--cui-markdown-inline-code-foreground<color>var(--foreground)
--cui-markdown-inline-code-radius<length-percentage>+var(--radius-sm)
--cui-markdown-link-foreground<color>var(--primary-text)
--cui-markdown-image-outline-color<color>var(--image-outline)
--cui-markdown-table-cell-border-color<color>var(--border)
--cui-markdown-table-header-background<color>var(--muted)
--cui-markdown-font-size<length-percentage>var(--text-body)
--cui-markdown-line-height<number>var(--leading-relaxed)
--cui-markdown-flow-gap<length-percentage>calc(var(--spacing) * 4)
--cui-markdown-heading-gap<length-percentage>calc(var(--spacing) * 6)