Skip to content

fix(asciidoc): parse links and inline marks in block titles - #5144

Merged
PeterStaar-IBM merged 2 commits into
docling-project:mainfrom
shashank11yadav:fix/5142-asciidoc-title-links
Nov 3, 2026
Merged

PeterStaar-IBM merged 2 commits into
docling-project:mainfrom
shashank11yadav:fix/5142-asciidoc-title-links

Conversation

@shashank11yadav

@shashank11yadav shashank11yadav commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

Block titles now go through the same inline parsing as paragraph text.

  • A title before a paragraph or a list (.Title ...) keeps links as hyperlinks and stays bold. Inline marks such as *x* are removed from the text, so .The *main* step gives the bold text The main step.
  • Picture, table and listing captions stay a single text item, as in the HTML backend. Their text is parsed, so .See https://example.com[Docs] gives the caption See Docs. The caption keeps a hyperlink only when the link covers the whole caption, so .https://example.com[Docs] gives Docs with the link. Splitting captions into runs would need a caption group; happy to do that if preferred.

Behavior changes:

  • A title with a link before a paragraph or list becomes a bold inline group, not one paragraph.
  • Captions lose inline marks (bold, italic, code) in their text.
  • A caption that mixes a link with other text loses the hyperlink. Its text keeps the link label.

Tests (tests/test_backend_asciidoc.py):

  • test_links_in_block_titles_of_paragraphs_and_lists: a link in a title before a paragraph and before a list.
  • test_links_in_block_titles_strip_inline_marks: a title with *main* gives the bold text The main step.
  • test_links_in_block_titles_of_pictures_tables_and_code: picture, table and listing captions, with two titles each.

Overlapping open PRs: #5039, #5117 and #4878 change the same block-title code. Expect a small rebase on whichever lands second.

Issue resolved by this Pull Request:
Resolves #5142

Checklist:

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

Review evidence:

Before: on upstream/main, a link in a block title stays raw text (https://example.com[Docs]), bold titles keep their asterisks, and picture, table and listing captions have no hyperlink. The new tests fail on upstream/main.

After: the new tests pass. Commands run:

  • uv run pytest tests/test_backend_asciidoc.py: 77 passed.
  • uv run ruff check --config=pyproject.toml docling tests docs/examples perfs: passed.
  • uv run ruff format --check --config=pyproject.toml docling tests docs/examples perfs: passed.
  • uv run --no-sync ty check: passed.

Checks cover the document tree (labels, inline groups, bold, hyperlinks) and the Markdown export. No reference data changed.

Not run: the full test suite and make check.

Block titles skipped inline parsing, so a link like https://example.com[Docs] stayed raw text. Titles before paragraphs and lists now go through _flush_text_data as bold text with hyperlinks. Picture, table and code captions are a single text item, so they get the parsed text and keep the hyperlink only when it covers the whole caption.

Signed-off-by: Shashank Yadav <[email protected]>
A block title before a paragraph or list kept the raw asterisks of bold marks in its text. Write the parsed text instead, as captions already do.

Signed-off-by: Shashank Yadav <[email protected]>
@github-actions

github-actions Bot commented Nov 2, 2026

Copy link
Copy Markdown
Contributor

✅ DCO Check Passed

Thanks @shashank11yadav, all your commits are properly signed off. 🎉

@mergify

mergify Bot commented Nov 2, 2026

Copy link
Copy Markdown
Contributor

Merge Protections

🟢 Merge protection satisfied — ready to merge.

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)(?:\(.+\))?(!)?:

@github-actions github-actions Bot added ai:ci-safe AI triage found no CI-safety concern (advisory) asciidoc issue related to asciidoc backend bug Something isn't working labels Nov 2, 2026
@github-actions

github-actions Bot commented Nov 2, 2026

Copy link
Copy Markdown
Contributor

AI triage (advisory)

Checked commit 2f0f0c8cf4. The analysis read the diff only. It did not run code from this pull request.

The PR parses inline markup in AsciiDoc block titles. A title before a paragraph or list keeps links as hyperlinks and stays bold. Picture, table and listing captions get their inline marks removed and keep a hyperlink only when one link covers the whole caption.

Topic labels added: bug, asciidoc.

CI safety: no concern found. A maintainer must still approve CI.

5 related pull request(s) in the same code
PR State Signal Assessment
#5010 open changes the same code related: It changes AsciiDoc table cell and row handling. This PR changes block title and caption parsing. The two share only the file.
#3891 open changes the same code related: It changes whitespace handling of runs in _flush_text_data. This PR adds a bold argument to the same function for block titles. The goals differ, but a merge conflict is likely.
#5117 open referenced as #5117 related: It replaces attribute references in AsciiDoc text. This PR parses links and marks in block titles. The two touch _flush_text_data and the caption code, but they fix different problems.
#5039 open referenced as #5039 related: It sets the parent of picture, table and code captions. This PR changes the text and hyperlink of the same captions. The edits are on the same lines, but the problems differ.
#4878 open referenced as #4878 related: It flushes the pending paragraph before a list or table. This PR changes how the block title before a list is flushed. The two touch nearby code, but they fix different problems.

The ai:* labels are advisory. They do not approve CI and they do not add tests:full. A new push runs this check again.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AI first review (advisory): no blocker found

This review covers the full diff at 2f0f0c8cf4. It read the code and did not run it.

AsciiDoc block titles before paragraphs, lists, pictures, tables, and code blocks parse inline marks and links correctly without regressions in plain block titles.

A maintainer makes the merge decision. This review never approves the pull request.

@github-actions github-actions Bot added the ai:review-lgtm AI first review found no blocker or major issue (advisory) label Nov 2, 2026
@codecov

codecov Bot commented Nov 3, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@PeterStaar-IBM PeterStaar-IBM left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm!

@PeterStaar-IBM
PeterStaar-IBM merged commit 0634e2f into docling-project:main Nov 3, 2026
34 checks passed
ska2704 added a commit to ska2704/docling that referenced this pull request Nov 3, 2026
Keep the text and hyperlink from the block title parsing in docling-project#5144 and pass
the parent as well, so a linked caption stays in the section of its item.

Signed-off-by: SK Arin <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ai:ci-safe AI triage found no CI-safety concern (advisory) ai:review-lgtm AI first review found no blocker or major issue (advisory) asciidoc issue related to asciidoc backend bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

AsciiDoc: links in block titles stay as raw url[text] markup

2 participants