firecrawl / firecrawl/anydoc

Expose embedded image assets in markdown output

Open
#63 2 comments 1 reaction 0 assignees View on GitHub
enhancement P2
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 `![alt](...)` 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("![" in md) # False (no image references)
```

The asset data is extracted and available, but the markdown doesn't reference it.

## Request

It would be useful if `to_markdown_bytes()` emitted image references (e.g., `![alt text](asset:0)` or `![](embedded:image0.png)`) 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.