[Exporters] Add FigureEncoder to handle detected pictures by the layout model - #2137
Draft
felixdittrich92 wants to merge 3 commits into
Draft
[Exporters] Add FigureEncoder to handle detected pictures by the layout model#2137felixdittrich92 wants to merge 3 commits into
FigureEncoder to handle detected pictures by the layout model#2137felixdittrich92 wants to merge 3 commits into
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2137 +/- ##
==========================================
- Coverage 97.24% 97.19% -0.05%
==========================================
Files 169 170 +1
Lines 10040 10225 +185
==========================================
+ Hits 9763 9938 +175
- Misses 277 287 +10
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request introduces support for exporting detected figures (such as images or diagrams) in reading order when exporting documents to Markdown, AsciiDoc, and HTML formats. Figures detected by the layout model are now included in the reading order and can be materialized in various ways (inlined, referenced, or as placeholders) during export. The documentation and codebase have been updated to reflect and support this new functionality.
Exporters: Figure Handling and Reading Order
Figures detected by the layout model are now included in the reading order alongside blocks and tables, and are handled as special floating elements. This affects how content is linearized and exported, with figures optionally absorbing adjacent captions. (
[[1]](https://github.com/mindee/doctr/pull/2137/files#diff-4c8a0beab5e4c284ede1afc05149f48ef5ab259e3da92c3b528c14671908176dL115-R118),[[2]](https://github.com/mindee/doctr/pull/2137/files#diff-4c8a0beab5e4c284ede1afc05149f48ef5ab259e3da92c3b528c14671908176dL125-R131),[[3]](https://github.com/mindee/doctr/pull/2137/files#diff-4c8a0beab5e4c284ede1afc05149f48ef5ab259e3da92c3b528c14671908176dL150-R156),[[4]](https://github.com/mindee/doctr/pull/2137/files#diff-4c8a0beab5e4c284ede1afc05149f48ef5ab259e3da92c3b528c14671908176dL165-R174),[[5]](https://github.com/mindee/doctr/pull/2137/files#diff-4c8a0beab5e4c284ede1afc05149f48ef5ab259e3da92c3b528c14671908176dL187-R199),[[6]](https://github.com/mindee/doctr/pull/2137/files#diff-4c8a0beab5e4c284ede1afc05149f48ef5ab259e3da92c3b528c14671908176dL282-R303),[[7]](https://github.com/mindee/doctr/pull/2137/files#diff-4c8a0beab5e4c284ede1afc05149f48ef5ab259e3da92c3b528c14671908176dR317-R329),[[8]](https://github.com/mindee/doctr/pull/2137/files#diff-4c8a0beab5e4c284ede1afc05149f48ef5ab259e3da92c3b528c14671908176dR339-R383),[[9]](https://github.com/mindee/doctr/pull/2137/files#diff-4c8a0beab5e4c284ede1afc05149f48ef5ab259e3da92c3b528c14671908176dR393-R444))The
FigureEncoderclass and related functions are now imported and used to control how figures are materialized during export (as embedded images, referenced files, placeholders, or omitted). Exporters for Markdown, AsciiDoc, and HTML now support figures, with format-specific rendering and placeholders. ([[1]](https://github.com/mindee/doctr/pull/2137/files#diff-7d12e5d8d91d065449b99788d9539d946aaa2ebc4393ae9260e7f54b115ca59fR3),[[2]](https://github.com/mindee/doctr/pull/2137/files#diff-4c8a0beab5e4c284ede1afc05149f48ef5ab259e3da92c3b528c14671908176dR15-R19),[[3]](https://github.com/mindee/doctr/pull/2137/files#diff-4c8a0beab5e4c284ede1afc05149f48ef5ab259e3da92c3b528c14671908176dR533-R534),[[4]](https://github.com/mindee/doctr/pull/2137/files#diff-4c8a0beab5e4c284ede1afc05149f48ef5ab259e3da92c3b528c14671908176dR559-R566),[[5]](https://github.com/mindee/doctr/pull/2137/files#diff-4c8a0beab5e4c284ede1afc05149f48ef5ab259e3da92c3b528c14671908176dR581-R582),[[6]](https://github.com/mindee/doctr/pull/2137/files#diff-4c8a0beab5e4c284ede1afc05149f48ef5ab259e3da92c3b528c14671908176dR607-R615),[[7]](https://github.com/mindee/doctr/pull/2137/files#diff-4c8a0beab5e4c284ede1afc05149f48ef5ab259e3da92c3b528c14671908176dR639-R640))Documentation Updates
imagesargument or aFigureEncoder. Detailed usage examples and explanations are provided. ([[1]](https://github.com/mindee/doctr/pull/2137/files#diff-4ec60e4ff05a071e3e4c9e7964f251f5d1c3ba7ce8a5e384343266a6babca7d4R180-R223),[[2]](https://github.com/mindee/doctr/pull/2137/files#diff-bee53c8935e4aa8f6ad459b019fedd88844d2a783bda7f7298f47d8022e6b50aR477-R491))Internal Improvements
[doctr/io/exporters.pyL95-R105](https://github.com/mindee/doctr/pull/2137/files#diff-4c8a0beab5e4c284ede1afc05149f48ef5ab259e3da92c3b528c14671908176dL95-R105))These changes collectively make figure handling in document exports more robust, flexible, and user-configurable, improving the quality and fidelity of exported documents.