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
Relative
<base href>values discard the document origin during Markdown generation, producing incorrect link, image, and citation URLs. Resolve the base element against the document URL once; for example,../assets/onhttps://example.test/pages/index.htmlnow resolvesguide.htmltohttps://example.test/assets/guide.html.List of files changed and why
crawl4ai/html2text/__init__.py: resolve relative base URLs inHTML2Textand letCustomHTML2Textdelegate without overwriting or resolving the base twice.tests/unit/test_markdown_base_url.py: exercise both converters and the public Markdown generator, with relative bases and absolute, absent, and empty base controls.How Has This Been Tested?
On Windows with Python 3.12.14:
The new regression suite has 16 failures and 12 passing controls on the unchanged
developbase; all 28 cases pass with the fix. It covers path-relative, parent-relative, root-relative, and protocol-relative base URLs, with citations enabled and disabled. An independent public-API check also passes 96 scenarios across document URLs, base URLs, link forms, and both citation modes. Black checks pass for the new test file andgit diff --checkpasses. A scoped source Black check reports four existing whitespace-only lines on both unchangeddevelopand the fixed code. Browser, live crawling, and the full repository test suite were not run.Checklist:
No documentation change is needed for correcting the existing base URL behavior. The selected local suites pass as detailed above; the full suite was not run.