Skip to content

Commit 673d45d

Browse files
Fix/fix output in md tables (#54)
* 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]>
1 parent 39f6245 commit 673d45d

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

docling_core/types/doc/document.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -591,7 +591,13 @@ def export_to_markdown(self) -> str:
591591
for row in self.data.grid:
592592
tmp = []
593593
for col in row:
594-
tmp.append(col.text)
594+
595+
# make sure that md tables are not broken
596+
# due to newline chars in the text
597+
text = col.text
598+
text = text.replace("\n", " ")
599+
tmp.append(text)
600+
595601
table.append(tmp)
596602

597603
md_table = ""

0 commit comments

Comments
 (0)