Skip to content

feat(web): response-viewer transcript fallback + code-block rendering#102

Merged
Ark0N merged 2 commits into
Ark0N:masterfrom
TeigenZhang:feat/response-viewer-code-blocks
Jun 1, 2026
Merged

feat(web): response-viewer transcript fallback + code-block rendering#102
Ark0N merged 2 commits into
Ark0N:masterfrom
TeigenZhang:feat/response-viewer-code-blocks

Conversation

@TeigenZhang
Copy link
Copy Markdown
Contributor

Summary

Improves the response viewer when the JSONL transcript is unavailable (it has to fall back to the raw terminal buffer) and hardens code/diagram rendering.

Changes

  • app.js _cleanTerminalBuffer(): strip ANSI escapes + Claude CLI chrome (status bar, spinner, progress bar, prompt glyphs) so the fallback renders clean conversational text
  • app.js _preprocessAsciiArt(): wrap box-drawing/block-element diagrams in fenced code blocks (narrow trigger excludes arrows/geometric shapes common in prose) so marked.js preserves whitespace
  • styles.css: extend .rv-text rules to .response-viewer-body so fallback-rendered content gets the same typography, code-block, and table styling

Notes

Built on top of the existing response-viewer (copy button / wrap toggle already upstream); this fills the transcript-missing gap.

Test plan

  • tsc --noEmit passes (no .ts touched)
  • Open a response with no JSONL transcript, confirm clean render
  • Render a box-drawing diagram, confirm whitespace preserved

Teigen and others added 2 commits May 31, 2026 23:25
- Add _cleanTerminalBuffer(): strip ANSI escapes and Claude CLI chrome
  (status bar, spinner, progress bar, prompt glyphs) from the terminal
  buffer so the response viewer renders clean text when the JSONL
  transcript is missing.
- Add _preprocessAsciiArt(): wrap box-drawing/block-element diagrams in
  fenced code blocks (narrow trigger that excludes arrows/geometric
  shapes common in prose) so marked.js preserves their whitespace.
- Extend .rv-text rules to .response-viewer-body so fallback-rendered
  content gets the same typography, code-block, and table styling.
These two methods already exist on master (added in Ark0N#75). This branch
re-added byte-identical copies above _sanitizeHtml; in a JS class body the
later definition wins, so the duplicates were inert dead code. Remove them,
keeping only the genuinely new work: the _renderMarkdown null-safety fix and
the response-viewer CSS overhaul.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@Ark0N
Copy link
Copy Markdown
Owner

Ark0N commented Jun 1, 2026

Thank you as always for contributing, @TeigenZhang! 🙏

The response-viewer CSS overhaul is lovely — proportional prose font with monospace kept for code, the heading/blockquote/code styling, the readable max-width, and the smoother slide-in animation all make the viewer much nicer to read. The _renderMarkdown null-safety fix (text → src = text || '') is a good catch too.

One heads-up from review: this branch forked before realizing that _cleanTerminalBuffer and _preprocessAsciiArt already landed on master back in #75, so it had re-added byte-identical copies of both. In a JS class body the later definition wins, so the duplicates were inert dead code. I pushed a small cleanup commit (bdeab49) removing them, leaving just the genuinely-new CSS + null-safety work.

Verified after cleanup: each method now defined exactly once, tsc/lint/format/build all clean, node --check clean, and a test-merge confirms #100/#101 are preserved. Merging now.

@Ark0N Ark0N merged commit 68594ac into Ark0N:master Jun 1, 2026
1 check passed
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