Skip to content

Add native Markdown and HTML content rendering - #42

Draft
CodeZhangBorui wants to merge 22 commits into
mainfrom
feat/markdown-render
Draft

CodeZhangBorui wants to merge 22 commits into
mainfrom
feat/markdown-render

Conversation

@CodeZhangBorui

Copy link
Copy Markdown
Collaborator

Summary

Add a resizable content preview to the Debug page. The same UI library renders Markdown and HTML project descriptions, loads their images, and opens standalone images in a zoomable preview.

Motivation

Project descriptions can contain rich Markdown or HTML. The launcher needs a shared native renderer that can display both formats and diagnose image failures while testing provider content.

Changes

  • Move axlauncher_content_render into apps/ui/content-render as an independent UI library with an injected image transport.
  • Support centered images, linked badges, superscript notes, loading skeletons, and a zoomable image preview.
  • Use a compact SVG image-unavailable glyph. The inline renderer rasterizes the same SVG in a transparent slot. Include the asset in the Nix source fileset.
  • Load project images over HTTP and HTTPS through the system resolver. Report download and decode failures in debug builds and retry failed images when re-rendering.

Testing

  • cargo fmt --all --check
  • node scripts/desktop.ts exec cargo clippy --workspace --all-targets --all-features --locked -- -D warnings
  • node scripts/desktop.ts exec cargo nextest run --workspace --locked passed 604 tests with 15 skipped
  • pnpm architecture, cargo deny check, typos, tombi format --check, tombi lint, and reuse lint passed
  • A renderer test verifies that the SVG produces a visible glyph within a transparent image slot. Desktop visual verification and a local Nix build were not performed on this Windows host.
  • cargo shear reported 10 unused dependency findings involving tempfile, axlauncher_download_engine, and axlauncher_frontend.

Breaking Changes

None for launcher users. The renderer is a new workspace-internal library.

Signed-off-by: CodeZhangBorui <zhangborui.2008@foxmail.com>
Assisted-by: Codex
Expose bounded in-memory CDN image transfers through the desktop service and apply the same origin policy to redirects.

Signed-off-by: CodeZhangBorui <zhangborui.2008@foxmail.com>
Assisted-by: Codex
Add the native Markdown plugin with standalone image sizing, on-demand image loading, HTML extensions, and a Debug page editor and preview.

Signed-off-by: CodeZhangBorui <zhangborui.2008@foxmail.com>
Assisted-by: Codex
Use a shared height for the editor and preview with pointer and keyboard resizing in both layouts.

Signed-off-by: CodeZhangBorui <zhangborui.2008@foxmail.com>
Assisted-by: Codex
Reuse decoded images in a viewport-constrained GPUI dialog. Preserve external navigation for linked images and keep loading placeholders static.

Signed-off-by: CodeZhangBorui <zhangborui.2008@foxmail.com>
Assisted-by: Codex
Show the image directly over the backdrop with a close control, an optional caption, and viewport-aware sizing.

Signed-off-by: CodeZhangBorui <zhangborui.2008@foxmail.com>
Assisted-by: Codex
Fit images to the available window area and let users zoom around the pointer and pan to the edges. Provide toolbar controls for zoom and fit.

Signed-off-by: CodeZhangBorui <zhangborui.2008@foxmail.com>
Assisted-by: Codex
Open at the intrinsic size within the original viewer margins. Start gesture zoom at the displayed size and keep fit-to-window available on demand.

Signed-off-by: CodeZhangBorui <zhangborui.2008@foxmail.com>
Assisted-by: Codex
Rename the Markdown plugin and expose a shared renderer for Markdown and HTML in Debug. Reuse the zoomable image preview and show animated image loading placeholders.

Signed-off-by: CodeZhangBorui <zhangborui.2008@foxmail.com>
Assisted-by: Codex
Use a common HTTP and HTTPS image transport for project descriptions. Return a timeout promptly when the system resolver is still blocked so the preview can leave its loading state.

Signed-off-by: CodeZhangBorui <zhangborui.2008@foxmail.com>
Assisted-by: Codex
Resolve external image hosts through the system resolver so preview requests follow the configured network route.

Signed-off-by: CodeZhangBorui <zhangborui.2008@foxmail.com>
Assisted-by: Codex
Preserve download and decode errors for debug logs. Show an embedded failure icon and clear failed cache entries when rendering a new document snapshot.

Signed-off-by: CodeZhangBorui <zhangborui.2008@foxmail.com>
Assisted-by: Codex
Keep the rendering crate under the UI layer and move its mirrored tests alongside it. Preserve the existing dependency boundary and caller API.

Signed-off-by: CodeZhangBorui <zhangborui.2008@foxmail.com>
Assisted-by: Codex
Draw a compact unavailable-image glyph in the muted theme color. Rasterize the same SVG inside a transparent slot for TextView inline images.

Signed-off-by: CodeZhangBorui <zhangborui.2008@foxmail.com>
Assisted-by: Codex
Keep the project image service alongside the desktop services introduced by the on-demand workers.

Signed-off-by: CodeZhangBorui <zhangborui.2008@foxmail.com>
Assisted-by: Codex
Keep the embedded SVG in the source fileset used to build the launcher.

Signed-off-by: CodeZhangBorui <zhangborui.2008@foxmail.com>
Assisted-by: Codex
Store the standalone editor beside the frontend feature modules and let the panel mount it in the Debug page.

Signed-off-by: CodeZhangBorui <zhangborui.2008@foxmail.com>
Assisted-by: Codex
@sourcery-ai

sourcery-ai Bot commented Nov 28, 2026

Copy link
Copy Markdown

Sorry @CodeZhangBorui, you've used your own review budget of 250,000 diff characters for the last 7 days.

You can request another review in 1 day and 9 hours by commenting @sourcery-ai review. Upgrade to get a review now.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 28, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-28T11:20:34.000294Z 56e5670 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@github-actions github-actions Bot added module: domain Domain identifiers and base types module: frontend State, layout and window wiring module: network HTTP and protocol clients module: repository Build, tooling and CI module: ui Palette and gpui-kit vocabulary version: 0.1.0 Version a report or pull request belongs to status: unreviewed No maintainer has reviewed this yet labels Nov 28, 2026
@github-actions

github-actions Bot commented Nov 28, 2026 •

Copy link
Copy Markdown

Impact analysis

Note

Advisory only: the affected test list is broad by design and does not gate this pull request. A missing index fails the job instead of posting an empty result.

39 changed files · 19 source · 11 test · 9 other · 120 affected test files

codegraph status: 415 files · 7343 nodes · javascript, nix, rust, typescript, yaml

Changed files

  • other: .agents/docs/crates.md
  • other: Cargo.lock
  • other: Cargo.toml
  • other: apps/core/Cargo.toml
  • source: apps/core/network/src/lib.rs
  • source: apps/core/network/src/project_images.rs
  • source: apps/core/network/src/transfer.rs
  • source: apps/core/src/desktop.rs
  • source: apps/core/src/desktop/project_images.rs
  • other: apps/frontend/Cargo.toml
  • source: apps/frontend/src/content_debug.rs
  • source: apps/frontend/src/lib.rs
  • source: apps/frontend/src/panel/mod.rs
  • source: apps/frontend/src/panel/shell.rs
  • other: apps/ui/content-render/Cargo.toml
  • other: apps/ui/content-render/assets/image-unavailable.svg
  • source: apps/ui/content-render/src/blocks.rs
  • source: apps/ui/content-render/src/html.rs
  • source: apps/ui/content-render/src/image_cache.rs
  • source: apps/ui/content-render/src/image_placeholder.rs
  • source: apps/ui/content-render/src/image_preview.rs
  • source: apps/ui/content-render/src/images.rs
  • source: apps/ui/content-render/src/lib.rs
  • source: apps/ui/content-render/src/picture.rs
  • source: apps/ui/content-render/src/preview.rs
  • source: apps/ui/src/lib.rs
  • other: nix/common.nix
  • other: prek.toml
  • test: tests/apps/core/network/src/project_images.rs
  • test: tests/apps/core/src/desktop/project_images.rs
  • test: tests/apps/ui/content-render/src/blocks.rs
  • test: tests/apps/ui/content-render/src/html.rs
  • test: tests/apps/ui/content-render/src/image_cache.rs
  • test: tests/apps/ui/content-render/src/image_placeholder.rs
  • test: tests/apps/ui/content-render/src/image_preview.rs
  • test: tests/apps/ui/content-render/src/images.rs
  • test: tests/apps/ui/content-render/src/picture.rs
  • test: tests/apps/ui/content-render/tests/document.rs
  • test: tests/tests/crate_boundaries.rs

Affected tests

CodeGraph followed imports 5 steps deep from the changed sources with codegraph affected.

Mirrors (apps/frontend/)

  • tests/apps/frontend/src/installations.rs
  • tests/apps/frontend/src/modpacks/service.rs
  • tests/apps/frontend/src/modpacks/service/acquisition.rs
  • tests/apps/frontend/src/panel/download_debug.rs
  • tests/apps/frontend/src/panel/download_debug/batch.rs
  • tests/apps/frontend/src/panel/instances.rs
  • tests/apps/frontend/src/panel/instances/launch.rs
  • tests/apps/frontend/src/panel/java/mod.rs
  • tests/apps/frontend/src/panel/memory_edits.rs
  • tests/apps/frontend/src/panel/profile_creation.rs
  • … 1 more in this group

Mirrors (apps/ui/content-render/)

  • tests/apps/ui/content-render/src/blocks.rs
  • tests/apps/ui/content-render/src/html.rs
  • tests/apps/ui/content-render/src/image_cache.rs
  • tests/apps/ui/content-render/src/image_placeholder.rs
  • tests/apps/ui/content-render/src/image_preview.rs
  • tests/apps/ui/content-render/src/images.rs
  • tests/apps/ui/content-render/src/picture.rs
  • tests/apps/ui/content-render/tests/document.rs

Mirrors (apps/core/network/)

  • tests/apps/core/network/src/auth.rs
  • tests/apps/core/network/src/auth/callback.rs
  • tests/apps/core/network/src/dns.rs
  • tests/apps/core/network/src/lib.rs
  • tests/apps/core/network/src/mirrors.rs
  • tests/apps/core/network/src/project_images.rs
  • tests/apps/core/network/src/transfer.rs

Mirrors (apps/core/)

  • tests/apps/core/src/desktop/installation.rs
  • tests/apps/core/src/desktop/instance_settings.rs
  • tests/apps/core/src/desktop/java.rs
  • tests/apps/core/src/desktop/launching.rs
  • tests/apps/core/src/desktop/project_images.rs
  • tests/apps/core/src/desktop/sources.rs

Dependent tests (apps/core/launch)

Reached through dependencies of the changed code rather than through a mirrored test file in this crate.

  • tests/apps/core/launch/src/arguments.rs
  • tests/apps/core/launch/src/chain.rs
  • tests/apps/core/launch/src/chain/document_tests.rs
  • tests/apps/core/launch/src/classpath.rs
  • tests/apps/core/launch/src/classpath/tool_shadow_tests.rs
  • tests/apps/core/launch/src/flow/account_tests.rs
  • tests/apps/core/launch/src/flow/language_tests.rs
  • tests/apps/core/launch/src/flow/tests.rs
  • tests/apps/core/launch/src/flow/version_id_tests.rs
  • tests/apps/core/launch/src/jar.rs
  • … 13 more in this group

Dependent tests (apps/core/lib/installation)

Reached through dependencies of the changed code rather than through a mirrored test file in this crate.

  • tests/apps/core/lib/installation/src/loader.rs
  • tests/apps/core/lib/installation/src/loader/lifecycle.rs
  • tests/apps/core/lib/installation/src/prepare.rs
  • tests/apps/core/lib/installation/src/processors.rs
  • tests/apps/core/lib/installation/src/processors/templates.rs
  • tests/apps/core/lib/installation/src/runtime.rs
  • tests/apps/core/lib/installation/src/runtime/record.rs
  • tests/apps/core/lib/installation/src/vanilla.rs
  • tests/apps/core/lib/installation/tests/processor_fixture.rs
  • tests/apps/core/lib/installation/tests/stand_in.rs

Dependent tests (tests/tests)

Reached through dependencies of the changed code rather than through a mirrored test file in this crate.

  • tests/tests/comment_policy.rs
  • tests/tests/crate_boundaries.rs
  • tests/tests/embedded_workers.rs
  • tests/tests/external_formats.rs
  • tests/tests/filesystem_paths.rs
  • tests/tests/port_errors.rs
  • tests/tests/spi_contract.rs
  • tests/tests/unsafe_boundaries.rs

Dependent tests (apps/core/state)

Reached through dependencies of the changed code rather than through a mirrored test file in this crate.

  • tests/apps/core/state/src/files.rs
  • tests/apps/core/state/src/javas.rs
  • tests/apps/core/state/src/jobs.rs
  • tests/apps/core/state/src/profile.rs
  • tests/apps/core/state/src/profile/discovery.rs
  • tests/apps/core/state/src/profile/resources.rs
  • tests/apps/core/state/src/profile/update.rs
  • tests/apps/core/state/src/settings.rs

Dependent tests (apps/core/lib/download_engine)

Reached through dependencies of the changed code rather than through a mirrored test file in this crate.

  • tests/apps/core/lib/download_engine/src/lib.rs
  • tests/apps/core/lib/download_engine/src/lib/range_identity.rs
  • tests/apps/core/lib/download_engine/src/lib/range_recovery.rs
  • tests/apps/core/lib/download_engine/src/lib/retry_tests.rs
  • tests/apps/core/lib/download_engine/src/streaming.rs
  • tests/apps/core/lib/download_engine/src/weighted.rs

Dependent tests (apps/core/loader)

Reached through dependencies of the changed code rather than through a mirrored test file in this crate.

  • tests/apps/core/loader/src/forge.rs
  • tests/apps/core/loader/src/installer.rs
  • tests/apps/core/loader/src/installer/forge_inline.rs
  • tests/apps/core/loader/src/lib.rs
  • tests/apps/core/loader/src/neoforge.rs

Dependent tests (apps/core/lib)

Reached through dependencies of the changed code rather than through a mirrored test file in this crate.

  • tests/apps/core/lib/src/bootstrap.rs
  • tests/apps/core/lib/src/java_discovery.rs
  • tests/apps/core/lib/src/settings_client.rs

Dependent tests (apps/core/lib/accounts)

Reached through dependencies of the changed code rather than through a mirrored test file in this crate.

  • tests/apps/core/lib/accounts/src/accounts/sessions.rs
  • tests/apps/core/lib/accounts/src/accounts/yggdrasil.rs
  • tests/apps/core/lib/accounts/src/worker.rs

Dependent tests (apps/core/mc_version)

Reached through dependencies of the changed code rather than through a mirrored test file in this crate.

  • tests/apps/core/mc_version/src/java.rs
  • tests/apps/core/mc_version/src/maven.rs
  • tests/apps/core/mc_version/src/maven/order.rs

Dependent tests (apps/plugins/modpack)

Reached through dependencies of the changed code rather than through a mirrored test file in this crate.

  • tests/apps/plugins/modpack/src/curseforge.rs
  • tests/apps/plugins/modpack/src/lib.rs
  • tests/apps/plugins/modpack/src/multimc.rs

Dependent tests (tests/tests/embedded_workers)

Reached through dependencies of the changed code rather than through a mirrored test file in this crate.

  • tests/tests/embedded_workers/installation.rs
  • tests/tests/embedded_workers/java_discovery.rs
  • tests/tests/embedded_workers/settings.rs

Dependent tests (apps/core/lib/java_discovery)

Reached through dependencies of the changed code rather than through a mirrored test file in this crate.

  • tests/apps/core/lib/java_discovery/src/scan.rs
  • tests/apps/core/lib/java_discovery/src/windows.rs

Dependent tests (apps/core/spi)

Reached through dependencies of the changed code rather than through a mirrored test file in this crate.

  • tests/apps/core/spi/src/loader.rs
  • tests/apps/core/spi/src/mc_version.rs

Dependent tests (apps/core/storage)

Reached through dependencies of the changed code rather than through a mirrored test file in this crate.

  • tests/apps/core/storage/src/atomic_file.rs
  • tests/apps/core/storage/src/lib.rs

Dependent tests (apps/core/domain)

Reached through dependencies of the changed code rather than through a mirrored test file in this crate.

  • tests/apps/core/domain/src/lib.rs

Dependent tests (apps/core/lib/instance_settings)

Reached through dependencies of the changed code rather than through a mirrored test file in this crate.

  • tests/apps/core/lib/instance_settings/src/lib.rs

Dependent tests (apps/core/spi/network)

Reached through dependencies of the changed code rather than through a mirrored test file in this crate.

  • tests/apps/core/spi/network/src/lib.rs

Dependent tests (apps/core/install)

Reached through dependencies of the changed code rather than through a mirrored test file in this crate.

  • tests/apps/core/install/src/assets/tests.rs

Dependent tests (tests/tests/filesystem_paths)

Reached through dependencies of the changed code rather than through a mirrored test file in this crate.

  • tests/tests/filesystem_paths/rules.rs

Dependent tests (tests/tools/mmc-convert/src)

Reached through dependencies of the changed code rather than through a mirrored test file in this crate.

  • tests/tools/mmc-convert/src/patches.rs

Dependent tests (apps/core/storage/layout)

Reached through dependencies of the changed code rather than through a mirrored test file in this crate.

  • tests/apps/core/storage/layout/src/paths.rs

Import cycles

Touched 1 import cycle group containing 2 distinct files:

  • apps/frontend/src/lib.rs, apps/frontend/src/panel/mod.rs

Analyzed efc2f2bb6938..56e56708f261 with codegraph@1.6.4.

The full report is attached to this run as the pr-impact artifact.

@qodo-free-for-open-source-projects

qodo-free-for-open-source-projects Bot commented Nov 28, 2026 •

Copy link
Copy Markdown

PR Summary by Qodo

Add native Markdown and HTML previews to Debug

✨ Enhancement 🧪 Tests ⚙️ Configuration changes 🕐 40+ Minutes

Grey Divider

AI Description

• Add a resizable Debug preview for Markdown and HTML project descriptions.
• Render images with loading states, failure diagnostics, and a zoomable modal preview.
• Keep image downloads in the network layer and native rendering in a reusable UI library.
Merge Risk 🟡 Medium

Blast radius 🟢 Low 💥 1 capability

  • 1 affected end-to-end capability after fault-specific containment; implementation boundaries do not widen its functional scope.
  • The frontend Debug page, renderer, image cache, and preview controls form one bounded document-preview behavior; the core network service is an implementation hop for that same user-visible outcome, not an independent capability.
  • Image URL resolution, desktop request orchestration, network retrieval, decoding, caching, retry, and image-preview interaction are one end-to-end image-display behavior within the same bounded content-preview integration.
Behavioral complexity 🔴 High 🧩 Multiple interactions

  • Before, the repository had no production content-render path.
  • After, Markdown and HTML are parsed through distinct paths; embedded blocks, relative URL resolution, linked-image activation, asynchronous loading, bounded decoding, retry eviction, and modal zoom/pan state interact.
  • New correctness conditions include preserving HTML structure while rewriting only previewable images, keeping URL validation consistent across base URLs and redirects, ensuring per-document cache ownership and pixel-budget accounting, retaining load permits through decode, and keeping timeout, cancellation, semaphore release, and retry behavior consistent.
  • Before: no document-scoped image state or asynchronous image protocol existed.
  • After: up to 128 requests per document, eight concurrent loads, two decodes, a 128 MiB decoded budget, and a shared desktop request runtime are coordinated.
  • The new condition is that request admission, asset lifecycle, decode-budget commit, retry removal, and document destruction must remain consistent under concurrent completion and cancellation.
  • The zoom viewer also introduces bounded zoom, cursor-anchored transforms, panning clamps, and modal lifecycle states.
Potential damage 🟡 Medium 🩹 Temporary loss

  • If the new preview path regresses, the Debug document preview can be unavailable or incorrectly rendered.
  • No persistent project state or external business effect is written; reverting the code restores the prior application behavior.
  • The image-specific fallback preserves the rest of the document when only a request or decode fails.
  • Code rollback restores the prior application.
  • A transient image failure can be retried or the document can be rendered again; no data repair or external compensation is required.
Assessed commit 56e5670
Diagram

graph TD
  A["Debug editor"] --> B["Content renderer"] --> C["Native TextView"]
  B --> D["Image cache"] --> E["Desktop facade"] --> F["Network transport"]
  D --> G["Image modal"]
Loading
High-Level Assessment

The following are alternative approaches to this PR:

1. Embed a webview
  • ➕ Broader browser-native HTML and CSS support.
  • ➕ Less custom handling for rich document layouts.
  • ➖ Adds a separate rendering stack and platform integration burden.
  • ➖ Makes shared native styling and image diagnostics harder to maintain.

Recommendation: Keep the native GPUI renderer with an injected image transport. It fits the existing UI architecture and preserves the network-layer boundary; a webview is worth considering only if broader HTML/CSS fidelity becomes a requirement.

Files changed (33) +2239 / -50

Enhancement (18) +1775 / -3
lib.rsExpose project image retrieval +1/-0

Expose project image retrieval

• Publishes the new project-images network module.

apps/core/network/src/lib.rs

project_images.rsFetch bounded project images over HTTP(S) +54/-0

Fetch bounded project images over HTTP(S)

• Adds image downloads using system DNS, an HTTP(S)-only request and redirect policy, and an 8 MiB response limit.

apps/core/network/src/project_images.rs

transfer.rsPreserve underlying request error details +14/-3

Preserve underlying request error details

• Includes the error source chain in fatal and retryable request failures to improve image download diagnostics.

apps/core/network/src/transfer.rs

desktop.rsExpose desktop project image requests +1/-0

Expose desktop project image requests

• Registers the desktop image-request module.

apps/core/src/desktop.rs

project_images.rsAdd a timed desktop image-fetch entry point +38/-0

Add a timed desktop image-fetch entry point

• Wraps network image retrieval for background callers with a 15-second timeout. Shuts down the temporary runtime without waiting for a blocked DNS lookup.

apps/core/src/desktop/project_images.rs

content_debug.rsAdd a resizable document editor and preview +219/-0

Add a resizable document editor and preview

• Introduces Markdown and HTML source selection, explicit rendering, and a scrollable preview. Supports pointer and keyboard resizing in side-by-side or wrapped layouts.

apps/frontend/src/content_debug.rs

lib.rsRegister the content Debug module +1/-0

Register the content Debug module

• Makes the new Debug preview module available to the frontend.

apps/frontend/src/lib.rs

mod.rsRetain the content Debug view in the root panel +4/-0

Retain the content Debug view in the root panel

• Creates and stores the editor and preview as a root-view entity.

apps/frontend/src/panel/mod.rs

shell.rsShow content preview on the Debug page +1/-0

Show content preview on the Debug page

• Adds the content editor and preview to the Debug page layout.

apps/frontend/src/panel/shell.rs

blocks.rsRecognize rich Markdown image and HTML blocks +238/-0

Recognize rich Markdown image and HTML blocks

• Extracts standalone and linked images, centered HTML, dimensions, and superscript notes from Markdown content for specialized rendering.

apps/ui/content-render/src/blocks.rs

html.rsMake unlinked HTML images previewable +141/-0

Make unlinked HTML images previewable

• Wraps eligible HTML images in document-local preview links while preserving existing image links and removing author-supplied preview actions.

apps/ui/content-render/src/html.rs

image_placeholder.rsShare an image-unavailable glyph across layouts +53/-0

Share an image-unavailable glyph across layouts

• Displays the SVG glyph for standalone failures and rasterizes it into a transparent slot for inline images.

apps/ui/content-render/src/image_placeholder.rs

image_preview.rsAdd a zoomable image modal +375/-0

Add a zoomable image modal

• Opens decoded images in a viewport-aware dialog with fit, zoom, pan, close, and optional caption controls.

apps/ui/content-render/src/image_preview.rs

images.rsLoad, cache, and diagnose document images +205/-0

Load, cache, and diagnose document images

• Uses an injected fetcher for on-demand image assets, bounded decoding, animated loading skeletons, and failure placeholders. Enables failed-image retries on re-render and redacted debug diagnostics.

apps/ui/content-render/src/images.rs

lib.rsExpose the content renderer API +16/-0

Expose the content renderer API

• Organizes renderer modules and exports document, renderer, and content-type APIs.

apps/ui/content-render/src/lib.rs

picture.rsRender responsive standalone images +180/-0

Render responsive standalone images

• Sizes images and placeholders using intrinsic or declared dimensions. Opens unlinked loaded images in the modal while preserving external navigation for linked images.

apps/ui/content-render/src/picture.rs

preview.rsAdapt Markdown and HTML to native text views +230/-0

Adapt Markdown and HTML to native text views

• Creates retained document views with custom Markdown blocks, shared image loading, and HTTP(S) link handling. Routes eligible HTML image activation to the modal.

apps/ui/content-render/src/preview.rs

lib.rsRe-export native preview components +4/-0

Re-export native preview components

• Exposes GPUI Kit text, resize, dialog, and skeleton components through the existing UI facade.

apps/ui/src/lib.rs

Tests (9) +425 / -1
project_images.rsTest project image URL policy +33/-0

Test project image URL policy

• Checks that common HTTP(S) image hosts are accepted and non-web URLs or embedded credentials are rejected.

tests/apps/core/network/src/project_images.rs

project_images.rsTest timeout behavior during blocked lookup +37/-0

Test timeout behavior during blocked lookup

• Verifies that an image request returns its timeout result without waiting for a blocking lookup to finish.

tests/apps/core/src/desktop/project_images.rs

blocks.rsTest rich Markdown block recognition +70/-0

Test rich Markdown block recognition

• Covers centered images, badge dimensions and links, superscript formatting, and content left to the standard renderer.

tests/apps/ui/content-render/src/blocks.rs

html.rsTest HTML image preview-link rewriting +46/-0

Test HTML image preview-link rewriting

• Verifies preview links for standalone and inline images, preservation of existing links, and rejection of author-supplied preview actions.

tests/apps/ui/content-render/src/html.rs

image_placeholder.rsTest rasterized failure glyph visibility +23/-0

Test rasterized failure glyph visibility

• Confirms the inline SVG produces a visible glyph with transparent space around it.

tests/apps/ui/content-render/src/image_placeholder.rs

image_preview.rsTest modal sizing and zoom geometry +89/-0

Test modal sizing and zoom geometry

• Covers image fitting, opening sizes, cursor-anchored zoom, and pan boundaries.

tests/apps/ui/content-render/src/image_preview.rs

images.rsTest image assets, decoding, and diagnostics +87/-0

Test image assets, decoding, and diagnostics

• Checks skeleton frames, PNG and WebP decoding, oversized and invalid image rejection, and URL redaction.

tests/apps/ui/content-render/src/images.rs

picture.rsTest standalone image dimensions +35/-0

Test standalone image dimensions

• Verifies intrinsic sizing, declared HTML dimensions, aspect ratios, and zero-sized image boxes.

tests/apps/ui/content-render/src/picture.rs

crate_boundaries.rsEnforce the renderer's crate boundary +5/-1

Enforce the renderer's crate boundary

• Allows the renderer to depend on the UI facade and the frontend to depend on the renderer, without granting the renderer a network implementation dependency.

tests/tests/crate_boundaries.rs

Documentation (1) +3 / -0
crates.mdDocument renderer ownership and image DNS policy +3/-0

Document renderer ownership and image DNS policy

• Adds the content-render crate to the workspace inventory and explains that image HTTP access remains in the network layer. Documents system-resolver routing for project images.

.agents/docs/crates.md

Other (5) +36 / -46
Cargo.tomlRegister the content renderer and parsing dependencies +5/-0

Register the content renderer and parsing dependencies

• Adds the renderer as a workspace member and dependency, alongside Markdown and HTML parsing crates.

Cargo.toml

Cargo.tomlDepend on the content-render library +1/-0

Depend on the content-render library

• Adds the workspace-internal renderer to the frontend dependencies.

apps/frontend/Cargo.toml

Cargo.tomlDefine an independent native content-render crate +22/-0

Define an independent native content-render crate

• Declares the UI-layer renderer and its HTML, Markdown, image, and URL dependencies without depending on the network implementation.

apps/ui/content-render/Cargo.toml

common.nixInclude renderer assets in Nix sources +1/-0

Include renderer assets in Nix sources

• Adds the content-render asset directory so the embedded image-unavailable SVG is available to Nix builds.

nix/common.nix

prek.tomlKeep hook declarations compatible with TOML 1.0 +7/-46

Keep hook declarations compatible with TOML 1.0

• Rewrites multiline inline hook tables as single-line declarations without changing their configured behavior.

prek.toml

@qodo-free-for-open-source-projects

qodo-free-for-open-source-projects Bot commented Nov 28, 2026 •

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (1) 📘 Rule violations (0) 📎 Requirement gaps (0) 🎨 UX issues (0) 🔗 Cross-repo conflicts (0) 📜 Skill insights (0)

Grey Divider


Remediation recommended

1. Some centered images cannot open previews ✓ Resolved
Description
html_block falls back to Block::CenteredHtml when a center element contains multiple images or
an image nested in a non-empty element, and render_block displays that block without image-preview
link binding. Those Markdown images can load and display, but clicking them cannot reach the preview
action used for single direct images and HTML documents.

2. Image previews misfit resized windows ✓ Resolved
Description
open assigns the dialog pixel dimensions captured from window.viewport_size() when the preview
is opened. If the window is resized while the dialog remains open, its stage retains those
dimensions while the image layout reads the current viewport, leaving the preview clipped or
undersized and its interaction area out of step with the window.

3. Description images can probe the user's LAN 🐞 Bug ⛨ Security
Description
allows_image checks the URL scheme and credentials but not whether its destination is loopback,
link-local or private, and redirects use the same check. When an untrusted project description
contains an image URL pointing to a local service or a public URL that redirects there, rendering
the description can send a GET request to that service.
Code

apps/core/network/src/project_images.rs[R13-17]

+fn allows_image(url: &Url) -> bool {
+    matches!(url.scheme(), "http" | "https")
+        && url.username().is_empty()
+        && url.password().is_none()
+}
Evidence
The predicate passed to ReqwestNetwork::build checks the scheme and URL credentials, while both
check_target and redirect_policy reuse it. The system resolver supplies addresses without
filtering private or local ranges, so neither the initial request nor a redirect is blocked on that
basis. Rendering a description automatically loads its HTML and Markdown images through
images::load_image.

apps/core/network/src/lib.rs[138-148]
apps/core/network/src/lib.rs[222-236]
apps/ui/content-render/src/images.rs[154-165]
apps/core/network/src/project_images.rs[13-29]
apps/core/network/src/dns.rs[175-177]
apps/core/network/src/lib.rs[223-240]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
Project-description images can trigger requests to loopback, link-local or private services, including through redirects. Keep public HTTP and HTTPS image hosts accessible while preventing those local destinations from being fetched.
## Fix Focus Areas
- apps/core/network/src/project_images.rs[13-29]
- apps/core/network/src/dns.rs[100-160]
- apps/core/network/src/lib.rs[223-240]
## Recommended Fix
In `allows_image`, reject IP-literal hosts in loopback, private, link-local, unspecified or unique-local ranges, as well as `localhost` and single-label hosts. Also enforce the destination policy on the addresses actually used for every image connection, including redirects: filter resolved addresses so a hostname that resolves to a non-global address cannot bypass the URL check, and ensure proxy routing does not bypass the policy.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


View review recommended (1)
4. Slow image hosts tie up UI worker threads ✓ Resolved
Description
DocumentImage::load returns load_image, an async fn that calls the synchronous fetch
transport. That transport (project_image) blocks its thread in runtime.block_on for up to the
15-second IMAGE_TIMEOUT. A description with many images on slow or blackholed hosts keeps one
background executor thread blocked per image, which starves other background tasks in the app until
the timeouts expire.


Informational

5. Every image builds a new HTTP stack ✓ Resolved
Description
project_image calls ReqwestNetwork::build on every request, and run_image_request creates a
fresh tokio runtime for each one. Every image therefore constructs four reqwest clients, a new
resolver and a new runtime. Connection pools and TLS sessions are never reused, so a description
with dozens of badges from the same host repeats DNS lookups, TLS handshakes and client setup for
every image.

Grey Divider

Tip of the day
💡 Did you know, you can turn these tips off under Display > Comment parts

More tips ↗ | Customize Qodo ↗ | Qodo docs ↗

Grey Divider

Qodo Logo

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 294868d35f

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread apps/ui/content-render/src/images.rs Resolved
Comment thread apps/core/network/src/project_images.rs Resolved
Size standalone images through one frame across loading, ready, and unavailable states. Omit the picture, including its link target, when either declared dimension is zero.

Signed-off-by: CodeZhangBorui <zhangborui.2008@foxmail.com>
Assisted-by: Codex
Own image assets per document, expose retry for failed images, and resolve relative addresses using a caller-provided base. Reuse the desktop image transport and test image loading and activation through the rendered document.

Signed-off-by: CodeZhangBorui <zhangborui.2008@foxmail.com>
Assisted-by: Codex
Signed-off-by: CodeZhangBorui <zhangborui.2008@foxmail.com>
Assisted-by: Codex
Signed-off-by: CodeZhangBorui <zhangborui.2008@foxmail.com>
Assisted-by: Codex

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 33328b6b17

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread apps/ui/content-render/src/picture.rs Resolved
Signed-off-by: CodeZhangBorui <zhangborui.2008@foxmail.com>
Assisted-by: Codex
@xinvxueyuan
xinvxueyuan marked this pull request as draft November 28, 2026 11:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

module: domain Domain identifiers and base types module: frontend State, layout and window wiring module: network HTTP and protocol clients module: repository Build, tooling and CI module: ui Palette and gpui-kit vocabulary status: unreviewed No maintainer has reviewed this yet version: 0.1.0 Version a report or pull request belongs to

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant