AsciiDoc: thematic breaks and page breaks are kept as text or turned into list items
Maintainers usually reply within 2 days
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 72/100
Research direction
The break handling lives in docling/backend/asciidoc_backend.py, the module the repro imports as AsciiDocBackend. Run the included loop over the markers to see which lines become paragraphs or list items. Done means each marker between two paragraphs yields only the two paragraph texts, while a break inside a paragraph and lines like -- not a break keep their text.
Written by the indexing model from the issue text.
Description
Bug
The AsciiDoc backend does not know thematic breaks and page breaks. A line that starts a block and holds ''', ---, *** or <<< comes out as paragraph text. A line with * * * or - - - is read as a list item whose text is * * or - -. These lines separate blocks, so they must not add content to the document.
AsciiDoc has these breaks: ''' (three or more single quotes), ---, - - -, ***, * * *, ___ and _ _ _ for a thematic break, and <<< for a page break.
Steps to reproduce
from io import BytesIO
from docling.backend.asciidoc_backend import AsciiDocBackend
from docling.datamodel.base_models import InputFormat
from docling.datamodel.document import InputDocument
for marker in ["'''", "---", "***", "<<<", "* * *", "- - -"]:
source = f"First paragraph.\n\n{marker}\n\nSecond paragraph.\n"
in_doc = InputDocument(
path_or_stream=BytesIO(source.encode("utf-8")),
format=InputFormat.ASCIIDOC,
backend=AsciiDocBackend,
filename="test.adoc",
)
doc = in_doc._backend.convert()
print(repr(marker), [item.text for item, _ in doc.iterate_items() if hasattr(item, "text")])
Result on main at 1ae470a1 (the break handling is unchanged on main at b9bf356f): the marker appears between the two paragraphs, as text for ''', ---, *** and <<<, and as a list item for * * * and - - -.
Expected: ['First paragraph.', 'Second paragraph.'] for every marker.
A break inside a paragraph (First line. / ''' / Second line. on consecutive lines) is text in AsciiDoc, and a line such as -- not a break or <<anchor>> is not a break. These keep their text.
I have a fix with a test and can open a PR.
Docling version
Docling version: main @ 1ae470a1 (code unchanged at b9bf356f, 2.150.0)
Python version
Python 3.13.3
- Dominant language
- Python
- Stars
- 71k
- Forks
- 5.4k
- Avg merge
- 2d 22h
- Merged PRs (30d)
- 161
Getting set up
- Ships a Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from docling-project/docling
-
Difficulty 2/5 1-3 hours Newbie friendliness 69/100
docling-project/docling#5592 ·
Maintainers usually reply within 2 days
-
`api_image_request` logs and propagates the raw error response body, leaking the request's API key on 401Possibly taken @prassu017 claimed this 7 days ago. Openbug priority:critical
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
docling-project/docling#5486 · 1 comment · 1 reaction ·
Maintainers usually reply within 2 days
-
AFP: export_to_doctags() raises ZeroDivisionError because every page has size 0x0Possibly taken @Krushil-Dhankecha claimed this 12 days ago. Openbug priority:medium
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
docling-project/docling#5355 · 1 comment ·
Maintainers usually reply within 2 days
-
Merged paragraph across pages of different heights: continuation bbox uses the first page's heightPossibly taken @galer1us claimed this 15 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
docling-project/docling#5286 ·
Maintainers usually reply within 2 days
-
CSV: a custom delimiter in the sep= hint is rejectedPossibly taken @saiteja-018 claimed this 15 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
docling-project/docling#5284 ·
Maintainers usually reply within 2 days
All issues in docling-project/docling
Similar issues
-
app: scripts status: backlog type: housekeeping
Difficulty 1/5 1-3 hours Newbie friendliness 88/100
netbox-community/netbox-scripts#239 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
LmeSzinc/AzurLaneAutoScript#6194 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 79/100
micronaut-projects/micronaut-core#14585 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
langgenius/graphon#443 ·
Maintainers usually reply within 2 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 90/100
Maintainers usually reply within 1 day