Skip to content

Carousel view has invalid markdown rendering for "Viewed image..." #307446

Closed

Description

Image

See bottom where the image markdown is messed up [](path) and rendered to user.

Activity

  1. added this to the Backlog milestone on Apr 2, 2026
  2. added
    bug
    on May 29, 2026
  3. arun-357 commented on Jun 10, 2026

    @arun-357
    Contributor

    Hi, I'm an external contributor and would love to take a stab at this if it's still open — happy to dig into the image carousel code. Would that be welcome? Dmitriy Vasyura (@dmitrivMS)

  4. dmitrivMS commented on Jun 10, 2026

    @dmitrivMS
    Collaborator
  5. arun-357 commented on Jun 10, 2026

    @arun-357
    Contributor

    Hi, I've put together a fix for this — PR is open and ready for review whenever you get a chance. Dmitriy Vasyura (@dmitrivMS)

  6. added
    unreleased
    on Jun 10, 2026
  7. vs-code-engineering commented on Jun 10, 2026

    @vs-code-engineering
    Contributor

    Sharing media and context from merged PR #320754 for verification:

    Problem

    The image carousel's bottom caption shows raw markdown instead of readable text, e.g.:

    Viewed image [](file:///Users/pierceboggan/Documents/GitHub/coloring-book/homepage.png)
    

    Root cause:

    • Tool invocations carry invocationMessage/pastTenseMessage typed string | IMarkdownString. Copilot's view-image tool produces markdown like Viewed image [](file:///…/homepage.png) (the empty-text link renders as a file widget in chat, but is raw syntax anywhere else).
    • chatImageExtraction.ts flattened the message to its raw markdown source via .value and stored that as the image caption.
    • The carousel editor renders captions as plain text (captionText.textContent = …, per its caption?: string contract), so the markdown syntax was displayed verbatim.

    Fix

    Preserve the message as string | IMarkdownString in chatImageExtraction.ts (common layer), and convert it to display text at the presentation layer in chatImageCarouselService.ts with a small toCaptionText() helper:

    stripIcons(renderAsPlaintext(caption, { useLinkFormatter: true }))

    This is the same conversion the chat UI already applies when rendering these tool messages as labels (see chatToolProgressPart.ts), so the carousel caption now matches what the user sees in chat: Viewed image homepage.png (useLinkFormatter resolves empty-text links to the file basename).

    Notes:

    • The conversion lives in the browser layer because renderAsPlaintext is in vs/base/browser and chatImageExtraction.ts is common-layer code.
    • The carousel editor (imageCarouselEditor.ts) is intentionally untouched — its plain-text caption contract is correct; the chat layer was handing it markdown.
    • Plain-string messages pass through verbatim; images without a tool message still show no caption.

    Tests

    • Added a regression test in chatImageCarouselService.test.ts (strips markdown from tool invocation message captions) using the exact message shape from the issue, plus a passthrough assertion for plain-string messages.
    • Updated chatImageExtraction.test.ts assertions for the caption type change (captions from IMarkdownString messages now assert on .value).

    Before / After

    Before:
    markdown1

    After:
    markdown2

    Source PR: #320754

  8. added
    insiders-released
    and removed
    unreleased
    on Jun 11, 2026
  9. locked and limited conversation to collaborators on Jul 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugimage-carouselinsiders-releasedverified

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions