feat(web): response-viewer transcript fallback + code-block rendering#102
Conversation
- 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>
|
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 One heads-up from review: this branch forked before realizing that Verified after cleanup: each method now defined exactly once, |
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 textapp.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 whitespacestyles.css: extend.rv-textrules to.response-viewer-bodyso fallback-rendered content gets the same typography, code-block, and table stylingNotes
Built on top of the existing response-viewer (copy button / wrap toggle already upstream); this fills the transcript-missing gap.
Test plan
tsc --noEmitpasses (no .ts touched)