docling-project / docling-project/docling

Table appears after lists in Markdown instead of between lists

Open
#2,652 3 comments 0 reactions 0 assignees View on GitHub
question
Dominant language
Python
Stars
66.4k
Forks
4.8k
Avg merge
3d 4h
Merged PRs (30d)
98

Description

### Question

Hello,

I am using Docling to export a PDF to Markdown. My PDF contains headings, paragraphs, lists and tables.
The PDFs I work with are sensitive, so I cannot share them. However, I have created a minimal example that reproduces the same problem which demonstrates my issue.

The expected Markdown output should look like this:

## 1. Part 1

- First part of my text in list format.

| Column 1 | Column 2 | Column 3 |
|----------|----------|----------|
| Test 1 | Test 2 | Test 3 |
| Test test 1 | Test test 2 | Test test 3 |

- Second part of my text in list format.

However, the actual output I get is:

## 1. Part 1

- First part of my text in list format.
- Second part of my text in list format.

| Column 1 | Column 2 | Column 3 |
|----------|----------|----------|
| Test 1 | Test 2 | Test 3 |
| Test test 1 | Test test 2 | Test test 3 |

As you can see, the table is exported after the list paragraphs instead of being between them.

Here is a snippet of how I run Docling:
```
self.pipeline_options = PdfPipelineOptions(
artifacts_path=settings.ARTIFACTS_PATH,
llm_model_name_or_path=settings.GRANITE_PATH
)
self.pipeline_options.do_ocr = False
self.pipeline_options.do_table_structure = True
self.pipeline_options.table_structure_options.do_cell_matching = True

self.converter = DocumentConverter(
format_options={
InputFormat.PDF: PdfFormatOption(
pipeline_options=self.pipeline_options
)
}
)
...

docling_content = self.converter.convert(file_path)
md_content = docling_content.document.export_to_markdown()

```

Is there a recommended way to ensure tables stay inline between paragraphs, or any advice on how I can handle this issue with Docling?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.