emrg: GUI workspace panel P3.3 — viewer hljs highlight + markdown render + image display (rant 2026-08-11T12:20:35) - #670
Conversation
…der + image display (rant 2026-08-11T12:20:35)
argszero
left a comment
There was a problem hiding this comment.
✅ LGTM — cycle
P3.3 viewer tiers verified: hljs highlight with extension→lang mapping (highlightAuto fallback), markdown via emrgMarkdown.renderMarkdown (DOMPurify), images via file:// with no read_file call + CSP img-src file:. Local: GUI 205/205 ✓ (3 new tests incl. image-skip + CSP assertion, hljs classes), pytest 694 ✓, doc guard 3/3 ✓, import + --help ✓. CI test run green.
argszero
left a comment
There was a problem hiding this comment.
✅ LGTM — cycle
Reviewed P3.3 (viewer hljs highlight + markdown render + image display) in a local worktree at branch head ec0f801:
- Image path: IMAGE_EXT detection (png/jpe?g/gif/svg/webp/bmp/ico, query/hash-stripped) →
<img src=file://...>direct display, no read_file call (per design R3-⑫); onerror → localized viewerError hint. CSPimg-srcupdated to includefile:(R7-①) — source-level assertion test guards regression. - Markdown (.md/.markdown/.mdown): rendered via emrgMarkdown.renderMarkdown (marked + DOMPurify, same source as chat) into .viewer-md; try/catch falls back to plain text.
- Code highlight: detectLang per-extension map aligned with highlight.custom.js registered languages (incl. Dockerfile special-case);
hljs.highlightexact-language when registered,highlightAutofallback, try/catch → escaped-text fallback (el() textContent preserved — no XSS since only hljs output is set via innerHTML).classList.addharness made variadic for real-DOM parity. - Binary path: test switched to .bin (pngs now take the image path) — negative state still covered.
- Verification: GUI suite 205/205 (3 new tests: image-skips-read_file + CSP file: assertion, markdown → .viewer-md, .py → hljs/language-python classes), pytest 694/694, doc guard 3/3, node --check clean. CI test PASS (31463373268). Mergeable CLEAN.
No issues found.
argszero
left a comment
There was a problem hiding this comment.
✅ LGTM — cycle
Third LGTM. P3.3 full viewer (hljs highlight + markdown render + image display) verified locally: GUI 205/205 ✓, pytest 694 ✓, doc guard 3/3 ✓, import + --help ✓. Image path via file:// direct (no read_file), CSP img-src file: asserted by test; markdown via emrgMarkdown.renderMarkdown; hljs exact-lang + highlightAuto fallback + escaped fallback. CI test green (31463373268). Mergeable CLEAN.
argszero
left a comment
There was a problem hiding this comment.
✅ LGTM — cycle (3rd)
Head ec0f801 unchanged since R739 full verification (GUI 205/205 ✓ pytest 694/694 ✓ doc guard 3/3 ✓; image-skips-read_file + CSP file: + md render + hljs highlight, XSS-safe). CI test run green (31463373268). Merge conditions met (3 consecutive ✅ from different cycles).
…viewer + P2.3/P3.4 HTML preview)
…viewer + P2.3/P3.4 HTML preview) (#672)
P3.3 of the workspace-panel rant: full viewer tiers on top of the P3 slice 1 basic viewer (#665) + P3.2 artifacts (#668).
Viewer rendering
hljs.highlightwith per-extension language detection (py/js/ts/sh/css/html/json/yaml/toml/go/rust/java/c/cpp/sql/xml/ini/dockerfile/diff — aligned with highlight.custom.js registered languages),highlightAutofallback, escaped-text fallback on any failureemrgMarkdown.renderMarkdown(marked + DOMPurify sanitize, same source as chat); falls back to plain text on errorfile://direct display — no read_file call (P1 daemon binary detection unused for images, per design R3-⑫); CSPimg-srcupdated to includefile:(R7-①)CSS:
.viewer-img(object-fit contain),.viewer-md(prose styling + code block padding).Tests: +3 renderer smoke (image skips read_file + CSP file: assertion, markdown renders viewer-md, .py highlight adds hljs/language-python classes); binary test switched to a non-image extension (.bin) since pngs now go the image path. Harness: classList.add made variadic (real DOM parity). GUI 202 → 205; pytest 694 ✓; doc guard 3/3 ✓; import + --help ✓.
Next: P2.3 WebContentsView HTML preview (main.js Electron side) — the last major workspace-panel slice.