Skip to content

Image attachment rewrite drops optional image title #4

@mmcky

Description

@mmcky

Context

From Copilot review on PR #1 (comment on packages/myst-to-ipynb/src/attachments.ts:91).

Problem

embedImagesAsAttachments drops the optional image title when rewriting ![alt](url "title") to ![alt](attachment:name). The regex replacement always omits the title portion.

Impact

Very low — image titles ("title" in ![alt](url "title")) are rarely used in practice and MyST source files don't commonly produce them. However, if titles are present in the serialized markdown, they should ideally be preserved for correctness.

Proposed Fix

Update the regex in embedImagesAsAttachments() to capture and preserve the optional title string in the rewritten attachment reference:

![alt](attachment:name "title")

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions