Skip to content

fix(md): keep tag-like text in plain-text input - #5689

Open
nicdeluc wants to merge 1 commit into
docling-project:mainfrom
nicdeluc:fix/txt-tag-like-text
Open

nicdeluc wants to merge 1 commit into
docling-project:mainfrom
nicdeluc:fix/txt-tag-like-text

Conversation

@nicdeluc

@nicdeluc nicdeluc commented Nov 30, 2026 •

Copy link
Copy Markdown
Contributor

Parse .txt and .text input without Marko's HTML elements, so text that looks like a tag (<Enter>, std::vector<int>, a line holding only <your name>) stays literal instead of being dropped. Markdown files are unchanged.

Since #3161 plain text goes through the Markdown backend, which drops every HTML tag except <br>. A small Marko extension, added only for plain-text input, turns off HTMLBlock and InlineHTML.

Trade-off: real HTML in a .txt file (<br>, comments, tables) now also stays literal text. The docs say so.

Issue resolved by this Pull Request:
Resolves #5688

Checklist:

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

Review evidence:

  • Before (main 4335cd3): a .txt file with Press <Enter> to go., a line <your name> and a list item - Item <one><br>two gives the texts ['Press to go.', 'Item\ntwo'].
  • After: ['Press <Enter> to go.', '<your name>', 'Item <one><br>two'], as two texts and a list item. .md input converts as before (First<bravo>second still becomes Firstsecond).
  • New test_plain_text_keeps_tag_like_text fails on main and passes with the change.
  • pytest tests/test_backend_markdown.py tests/test_backend_markdown_inline_html.py tests/test_backend_markdown_images.py tests/test_markdown_math.py tests/test_backend_text_encoding.py tests/test_input_doc.py tests/test_zip_batch_input.py tests/test_invalid_input.py tests/test_backend_patent_uspto.py tests/test_backend_html.py: 530 passed, 2 skipped. prek run --files on the changed files passes.
  • Not run: the full suite and the PDF, OCR and VLM tests, since the change is limited to the Markdown backend.

Signed-off-by: Nicolás de Lucas <196220050+nicdeluc@users.noreply.github.com>
@github-actions

Copy link
Copy Markdown
Contributor

✅ DCO Check Passed

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

@mergify

mergify Bot commented Nov 30, 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) bug Something isn't working markdown issue related to markdown backend plain text issue related to plain text input (read by the Markdown backend) priority:medium labels Nov 30, 2026
@github-actions

Copy link
Copy Markdown
Contributor

AI triage (advisory)

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

Plain-text input (.txt, .text) now keeps text that looks like an HTML tag, such as <Enter> or <your name>. A new Marko extension turns off HTMLBlock and InlineHTML for these files only. Markdown input does not change.

Topic labels added: bug, markdown, plain text, priority:medium.

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

1 related pull request(s) in the same code
PR State Signal Assessment
#5225 open changes the same code related: Both PRs change the Markdown(extensions=...) setup in convert() of md_backend.py. One adds LaTeX math handling and the other turns off HTML for plain text. The problems are different.

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 07e3aa0d67. It read the code and did not run it.

I checked that plain-text inputs with extensions .txt and .text disable Marko HTML blocks and inline HTML elements while standard Markdown parsing remains unchanged.

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

@codecov

codecov Bot commented Dec 1, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

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

ai:ci-safe AI triage found no CI-safety concern (advisory) bug Something isn't working markdown issue related to markdown backend plain text issue related to plain text input (read by the Markdown backend) priority:medium

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Plain-text input drops text that looks like an HTML tag

1 participant