Skip to content

Commit

Permalink
Fix/fix output in md tables (#54)
Browse files Browse the repository at this point in the history
* fix the output in markdown tables, remove newline in table-cells

Signed-off-by: Peter Staar <[email protected]>

* ran pre-commits

Signed-off-by: Peter Staar <[email protected]>

* fixed with space

Signed-off-by: Peter Staar <[email protected]>

---------

Signed-off-by: Peter Staar <[email protected]>
  • Loading branch information
PeterStaar-IBM authored Oct 24, 2024
1 parent 39f6245 commit 673d45d
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion docling_core/types/doc/document.py
Original file line number Diff line number Diff line change
Expand Up @@ -591,7 +591,13 @@ def export_to_markdown(self) -> str:
for row in self.data.grid:
tmp = []
for col in row:
tmp.append(col.text)

# make sure that md tables are not broken
# due to newline chars in the text
text = col.text
text = text.replace("\n", " ")
tmp.append(text)

table.append(tmp)

md_table = ""
Expand Down

0 comments on commit 673d45d

Please sign in to comment.