Skip to content

Image attachment embedding: resolve files/ output folder URLs #3

@mmcky

Description

@mmcky

Context

From Copilot review on PR #1 (comment on packages/myst-cli/src/build/ipynb/index.ts:48).

Problem

finalizeMdast writes output assets to ${dirname(output)}/files and rewrites image URLs to files/... web paths. However, collectImageData() resolves relative URLs against the source file's directory (article.file).

This means images produced into the files/ folder (e.g. from executed notebook outputs) won't be found by collectImageData() and therefore won't be embedded as cell attachments.

Proposed Fix

Pass the output directory / imageWriteFolder into collectImageData() and resolve files/... URLs against that folder as a fallback when the source-relative path doesn't exist.

Priority

Low — most QuantEcon lectures use static images that resolve correctly from source. This only affects executed output images (e.g. matplotlib plots saved during notebook execution).

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