feat: add configurable furniture_mode options to markdown serializer#666
Open
riyo264 wants to merge 6 commits into
Open
feat: add configurable furniture_mode options to markdown serializer#666riyo264 wants to merge 6 commits into
riyo264 wants to merge 6 commits into
Conversation
Contributor
|
✅ DCO Check Passed Thanks @riyo264, all your commits are properly signed off. 🎉 |
Contributor
Merge Protections🔴 1 of 2 protections blocking · waiting on 👀 reviews
🔴 Require two reviewer for test updatesWaiting for
This rule is failing.When test data is updated, we require two reviewers
Show 1 satisfied protection🟢 Enforce conventional commitMake sure that we follow https://www.conventionalcommits.org/en/v1.0.0/
|
Signed-off-by: riyo264 <supriyodhani50@gmail.com>
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.
Description
Context
Fixes #665
Following up on the architectural discussion during the MS Word backend update in the main
doclingrepository, this PR moves the configuration and handling of document furniture (headers and footers) to the serialization layer indocling-core.Currently, items on the
FURNITURElayer are omitted by default during Markdown serialization to prevent repetitive page layout clutter. This PR introduces a configurable parameter to let users selectively include headers and footers, which is highly beneficial for documents where margin metadata (like document versions, classification markers, or template notices) carries crucial context.Changes Introduced
FurnitureModeEnum: Defined three core serialization modes:none(Default): Retains existing behavior by dropping all furniture elements.all: Renders every header/footer sequentially as they appear across page boundaries.distinct: Implements text-based deduplication, serializing each unique header/footer exactly once when first encountered.MarkdownParams: Added thefurniture_modefield and introduced a Pydantic@model_validator(mode="after")to dynamically injectContentLayer.FURNITUREinto the active processinglayerswhenever a rendering mode is active.MarkdownDocSerializer.serialize: Built a stateful tracking mechanism (self._seen_furniture) directly onto the document serializer instance to handle thedistincttext-matching logic cleanly during the tree-walk traversal.test/test_serialization.py(test_md_furniture_modes) verifying the behavioral purity of all three configuration modes.Verification & Testing
Ran the serialization test suite locally using Python 3.14: