Skip to content

feat(html): optionally resolve relative link and image URLs - #4822

Draft
Afloat16 wants to merge 1 commit into
Unstructured-IO:mainfrom
Afloat16:Afloat16/html-relative-url-resolution-20261121
Draft

Afloat16 wants to merge 1 commit into
Unstructured-IO:mainfrom
Afloat16:Afloat16/html-relative-url-resolution-20261121

Conversation

@Afloat16

@Afloat16 Afloat16 commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Extracted links and image references often contain paths such as ../guide or image.png. These values lose their meaning after the page is ingested into a document index.

Add resolve_relative_urls=True to partition_html(). Resolve href, src and lazy image data-src values against the first HTML base element or, for URL inputs, the final response URL after redirects. This is preprocessing shared by both parser versions and makes no requests for linked resources. The default preserves existing relative values, and documents without a usable HTTP(S) base remain unchanged.

Validation

  • The seven new cases produce 4 failures and 3 passing controls on the base revision; all pass after the change.
  • Covers v1 link metadata, v2 retained HTML, redirects, first-base precedence, image references, absolute mailto URLs and default/no-base compatibility.
  • New cases plus the complete HTML partition module: 159 passed.
  • Full-repository Ruff 0.15.10 lint and format checks pass.

Draft pending the full repository test gate.

Checklist

  • Conventional user-facing title.
  • Maintainer: apply the enhancement label.
  • Full repository test gate.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant