Skip to content

emrg: GUI workspace panel P3.3 — viewer hljs highlight + markdown render + image display (rant 2026-08-11T12:20:35) - #670

Merged
argszero merged 1 commit into
masterfrom
feature/gui-workspace-panel-p33-viewer
Aug 11, 2026
Merged

emrg: GUI workspace panel P3.3 — viewer hljs highlight + markdown render + image display (rant 2026-08-11T12:20:35)#670
argszero merged 1 commit into
masterfrom
feature/gui-workspace-panel-p33-viewer

Conversation

@argszero

Copy link
Copy Markdown
Owner

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

  • Code highlight: hljs.highlight with 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), highlightAuto fallback, escaped-text fallback on any failure
  • Markdown files (.md/.markdown/.mdown): rendered via emrgMarkdown.renderMarkdown (marked + DOMPurify sanitize, same source as chat); falls back to plain text on error
  • Images (.png/.jpg/.gif/.svg/.webp/.bmp/.ico): file:// direct display — no read_file call (P1 daemon binary detection unused for images, per design R3-⑫); CSP img-src updated to include file: (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.

…der + image display (rant 2026-08-11T12:20:35)

@argszero argszero left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ 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 argszero left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ 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. CSP img-src updated to include file: (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.highlight exact-language when registered, highlightAuto fallback, try/catch → escaped-text fallback (el() textContent preserved — no XSS since only hljs output is set via innerHTML). classList.add harness 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 argszero left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ 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
argszero merged commit 80ab4a0 into master Aug 11, 2026
1 check passed

@argszero argszero left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ 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).

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.

1 participant