Expose embedded image assets in markdown output
- Dominant language
- Rust
- Stars
- 21.5k
- Forks
- 1.3k
- Avg merge
- 42m
- Merged PRs (30d)
- 17
Description
## Context
When processing DOCX files, `to_document()` correctly extracts embedded images into `doc.assets` (with raw bytes, media type, and origin part). However, these images don't appear in the markdown output from `to_markdown_bytes()` — there are no `` references, and the inline block model doesn't surface image inlines.
## Current behavior
```python
doc = anydoc.to_document(docx_bytes)
print(len(doc.assets)) # 1 (608KB PNG found)
md = anydoc.to_markdown_bytes(docx_bytes)
print("` or ``) at the positions where images appear in the document. The actual bytes are already in `doc.assets` — consumers could then decide whether to inline them as data URIs, upload them, or send them to a vision model for descriptions.
This would also apply to XLSX and PPTX files that contain embedded images/charts.
## Workaround
Using `to_document()` to get the asset bytes and processing them separately works, though without positional information it's hard to associate an image with the surrounding content.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start at the to_markdown_bytes() entry point and trace how the inline block model represents document content, then compare it with the assets produced by to_document(). Verify the DOCX image position first, and check whether the same representation can cover XLSX and PPTX images. Done means markdown contains image references at their document positions while preserving the existing asset bytes.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- backend
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 52/100