Skip to content

fix(markdown): preserve distinct image assets across exports - #1035

Draft
u7-u7 wants to merge 1 commit into
modelscope:mainfrom
u7-u7:fix/markdown-repeat-image-assets-20261029
Draft

u7-u7 wants to merge 1 commit into
modelscope:mainfrom
u7-u7:fix/markdown-repeat-image-assets-20261029

Conversation

@u7-u7

@u7-u7 u7-u7 commented Oct 29, 2026

Copy link
Copy Markdown

Change Summary

Prevent Markdown-to-HTML exports from silently replacing one report image with another. Current document-local numbered asset names collide across reports sharing an output directory, and repeated references within a report can also cause a later same-basename image to overwrite an earlier one.

Use streamed SHA-256 source-content filenames plus extension, and reuse repeated references. Distinct source images retain distinct assets across documents and repeated exports; identical bytes may share an asset. Existing resizing, compression, non-raster copying and resolution behavior remain unchanged.

Related issue number

No matching existing PR found in all-state searches for markdown/images, image/overwrite and markdown_converter. No issue automatically closed.

Validation

  • Unchanged main: both original regression cases fail. Tests resolve generated HTML references and inspect actual exported PNG pixels.
  • Fixed: 4 focused tests pass, covering repeated references, shared-folder exports, changed-source re-export without altering older reports, identical-content reuse and SVG copying.
  • tests/utils: 151 passed, 30 subtests passed, 1 existing failure: transcript fixture expects subagents/worker-1.jsonl instead of .ms_agent/subagents/worker-1.jsonl, reproduced with unchanged converter.
  • Changed-file pre-commit hooks, compilation and git diff --check pass. Full-repository hooks report baseline formatting/lint issues; unrelated automatic edits restored.

Not tested: browser visual rendering, PDF/DOCX/PPT export, other platforms/Python versions, concurrent source mutation or the full repository suite. Generated filenames change; callers should follow HTML references rather than assume numbered filenames. No live models or external services used.

Checklist

  • Title summarizes the change.
  • Regression tests cover the change.
  • Full-repository pre-commit passes (baseline issues above).
  • API unchanged; filename rationale documented inline.

AI assistance: implemented and tested with OpenAI Codex; automated review only, no human-review attestation. Submitted as a draft without requesting reviewers.

This branch has not been deployed

No deployments
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