Repository navigation
Conversation
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.
Summary
DefaultMarkdownGeneratorremoves the inner element and its attributes when both an outer and nested element matchpreserve_tags. Record every matching opening and closing tag so preserved HTML retains its nested structure, including nested tables.List of files changed and why
crawl4ai/html2text/__init__.py: retain nested preserved tags while flushing only the completed outer block.tests/unit/test_markdown_preserved_tags.py: cover matching tag names, mixed tag names, nested tables, three levels, ordinary children, and sibling blocks through the public Markdown generator.How Has This Been Tested?
On Windows with Python 3.12.14:
The new regression suite fails four cases on the unchanged
developbase, with its two controls passing. All six cases pass with the fix. An independent public-API check also passes 16 scenarios, covering nested structures and ordinary controls with citations enabled and disabled. Black checks pass for the new test file and the modified source lines;git diff --checkpasses. Browser, live crawling, and the full repository test suite were not run.Checklist:
No documentation change is needed for restoring the existing
preserve_tagsbehavior. The selected local regression suites pass as detailed above; the full suite was not run.