docling-project / docling-project/docling
Feature Request: Support table image output in Markdown export (image_mode)
- Dominant language
- Python
- Stars
- 66.4k
- Forks
- 4.8k
- Avg merge
- 2d 21h
- Merged PRs (30d)
- 84
Description
## Summary
When exporting a document to Markdown with image_mode=ImageRefMode.REFERENCED or EMBEDDED, **PictureItem** elements are correctly exported as image links (e.g., ). However, **TableItem** elements are only exported as Markdown table format (| ... |) and do not support image output, even when generate_table_images=True is enabled.
## Current Behavior
- PictureItem: Respects image_mode and outputs  when REFERENCED or EMBEDDED
- TableItem: Always outputs as Markdown table syntax, ignoring image_mode setting
- Table images generated via generate_table_images=True are stored in able.image but not included in Markdown output
## Expected Behavior
When generate_table_images=True and image_mode is REFERENCED or EMBEDDED:
- TableItem should include an image link (e.g., ) in addition to or instead of the Markdown table syntax
- This is especially important for scanned documents where OCR may not accurately reproduce table content
## Use Case
- PDF documents containing tables as images (not text-based tables)
- When users want to preserve the visual appearance of tables rather than OCR-extracted text
- Integration with tools that render Markdown (e.g., Obsidian, VS Code preview)
## Proposed Solution
Modify MarkdownTableItemSerializer in docling-core to:
1. Check if image_mode is REFERENCED or EMBEDDED
2. If able.image exists, output an image link similar to PictureItemSerializer._serialize_image_part()
## Workaround
Currently, we work around this by:
1. Generating table images via generate_table_images=True
2. Saving images manually ( able.image.pil_image.save())
3. Post-processing the Markdown file to insert image links at table positions
This works but is fragile and requires understanding the document body structure to find table positions.
## Environment
- docling version: 2.66.0
- docling-core version: 2.21.0
- Python: 3.11
Contributor guide
Assessment
This issue has not been assessed yet.