Skip to content

feat(jats): preserve external hyperlinks - #4029

Open
CreoEnMi-p wants to merge 1 commit into
docling-project:mainfrom
CreoEnMi-p:feat/jats-external-hyperlinks
Open

feat(jats): preserve external hyperlinks#4029
CreoEnMi-p wants to merge 1 commit into
docling-project:mainfrom
CreoEnMi-p:feat/jats-external-hyperlinks

Conversation

@CreoEnMi-p

Copy link
Copy Markdown

Summary

Preserve external JATS hyperlinks from <ext-link xlink:href="..."> elements in the generated DoclingDocument.

This addresses the Hyperlinks subtask of #3583.

Changes

  • propagate xlink:href through JATS inline parsing
  • preserve hyperlinks together with nested inline formatting
  • preserve hyperlink metadata on inline formula segments
  • keep linked and unlinked text in separate inline runs
  • prevent adjacent links with different targets from being merged
  • support both absolute URLs and relative paths
  • keep <ext-link> without xlink:href as normal text
  • update the affected JATS groundtruth files

Internal <xref> references, citation parsing, and embedded images are intentionally left out of scope.

Tests

Added focused regression coverage for:

  • linked text boundaries before and after <ext-link>
  • nested formatting inside hyperlinks
  • adjacent links with different targets
  • missing xlink:href
  • relative hyperlink targets
  • inline formulas inside hyperlinks

Validation:

  • uv run pytest tests/test_backend_jats.py -q — 40 passed
  • Ruff format/check — passed
  • ty check — passed
  • Tach boundaries and module coverage — passed
  • max-lines check — passed
  • dprint — passed
  • uv lock --locked — passed

On Windows, the full prek run --all-files cannot invoke the repository's python3 command because the local environment does not provide that executable alias. The affected Python-based hooks were run directly with the available Python executable and passed.

Checklist:

  • Documentation has been updated, if necessary.
  • Examples have been added, if necessary.
  • Tests have been added, if necessary.

Signed-off-by: CreoEnMi-p <pyr2207579512@gmail.com>
@github-actions

Copy link
Copy Markdown
Contributor

DCO Check Passed

Thanks @CreoEnMi-p, all your commits are properly signed off. 🎉

@mergify

mergify Bot commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

Merge Protections

🔴 1 of 2 protections blocking · waiting on 👀 reviews

Protection Waiting on
🔴 Require two reviewer for test updates 👀 reviews
🟢 Enforce conventional commit

🔴 Require two reviewer for test updates

Waiting for

  • #approved-reviews-by >= 2
This rule is failing.

When test data is updated, we require two reviewers

  • #approved-reviews-by >= 2

Show 1 satisfied protection

🟢 Enforce conventional commit

Make sure that we follow https://www.conventionalcommits.org/en/v1.0.0/

  • title ~= ^(fix|feat|docs|style|refactor|perf|test|build|ci|chore|revert)(?:\(.+\))?(!)?:

@CreoEnMi-p
CreoEnMi-p marked this pull request as ready for review August 19, 2026 05:23
@ceberam
ceberam self-requested a review August 19, 2026 07:48
@ceberam ceberam added the xml issue related to supported schema-specific XML formats label Aug 19, 2026
@codecov

codecov Bot commented Aug 19, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

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

Labels

xml issue related to supported schema-specific XML formats

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants