Skip to content

feat(jetbrains): add MdView markdown rendering component#9149

Merged
kirillk merged 7 commits intomainfrom
glittery-panama
Apr 20, 2026
Merged

feat(jetbrains): add MdView markdown rendering component#9149
kirillk merged 7 commits intomainfrom
glittery-panama

Conversation

@kirillk
Copy link
Copy Markdown
Contributor

@kirillk kirillk commented Apr 17, 2026

Summary

Adds a standalone MdView markdown rendering component for the JetBrains plugin, for future use in the chat UI to render assistant messages as formatted markdown instead of plain text.

  • Abstract class with a factory method (MdView.html()) — the rendering backend is fully hidden and swappable later
  • commonmark-java parser (with autolink, tables, strikethrough extensions) converts markdown to HTML
  • Backed by JBHtmlPane — the IntelliJ platform's native HTML component — so font and colours automatically follow the global editor colour scheme and editor font settings out of the box
  • Code font defaults to the _EditorFontNoLigatures_ placeholder, resolved at render time by EditorCssFontResolver to the actual editor monospace font
  • All style properties (font, foreground, background, link colour, code/pre theming, blockquote, table) are optional overrides on top of editor defaults; the override sheet is empty until a property is explicitly set
  • resetStyles() reverts all overrides back to editor defaults
  • Transparency (opaque = false) handled by Swing isOpaque + a background: transparent CSS body rule; no background is forced when transparent
  • Link clicks dispatched through an inner LinkListener interface with correct mouse-event coordinates
  • HTML output is sanitised (escapeHtml, sanitizeUrls) to prevent injection from model output
  • 44 unit tests covering rendering, streaming append, style overrides, editor font placeholder defaults, opacity, and resetStyles

Add a standalone markdown rendering component for the JetBrains plugin
using commonmark-java. This will be used in the chat UI to render
assistant messages as formatted markdown instead of plain text.

- Abstract MdView class with factory method and private HTML implementation
- Configurable styling (font, colors, opacity/transparency)
- Link click listeners via inner LinkListener interface
- Streaming-friendly set/append/clear API
- 44 unit tests covering rendering, styling, links, and transparency
@kilo-code-bot
Copy link
Copy Markdown
Contributor

kilo-code-bot Bot commented Apr 17, 2026

Code Review Summary

Status: No Issues Found | Recommendation: Merge

Files Reviewed (4 files)
  • packages/kilo-jetbrains/frontend/build.gradle.kts
  • packages/kilo-jetbrains/frontend/src/main/kotlin/ai/kilocode/client/ui/md/MdView.kt
  • packages/kilo-jetbrains/frontend/src/test/kotlin/ai/kilocode/client/ui/md/MdViewTest.kt
  • packages/kilo-jetbrains/gradle/libs.versions.toml

Reviewed by gpt-5.4-20260305 · 1,168,602 tokens

kirillk added 6 commits April 17, 2026 14:18
- Enable escapeHtml and sanitizeUrls on the commonmark HtmlRenderer
  to prevent raw HTML injection and dangerous URL schemes
- Fix LinkEvent.point to use MouseEvent.point instead of the
  component's origin coordinates
- Replace plain JEditorPane + manual CSS with JBHtmlPane, the IntelliJ
  platform's flagship HTML component
- Font and colours now default to the global editor colour scheme via
  JBHtmlPane's built-in EditorCssFontResolver and colorSchemeProvider
- Code font defaults to _EditorFontNoLigatures_ placeholder resolved by
  EditorCssFontResolver at render time
- All style properties become optional overrides applied via a
  customStyleSheetProvider; the override sheet is empty until a property
  is set, so editor defaults always win unless explicitly overridden
- Add resetStyles() to revert all overrides back to editor defaults
- Transparency (opaque=false) handled by Swing isOpaque + transparent
  CSS body rule; no manual background injection when transparent
- Update tests to use overrideSheet() and component state assertions
@kirillk kirillk enabled auto-merge April 20, 2026 17:41
@kirillk kirillk merged commit 1b8ed1e into main Apr 20, 2026
13 checks passed
@kirillk kirillk deleted the glittery-panama branch April 20, 2026 19:04
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