Skip to content

Commit 3b24373

Browse files
committed
fix: handle line breaks in cell content for markdown table formatting
--bug=1054683 --user=刘瑞斌 【github#2831】知识库上传excel、应用编排文档内容提取节点中上传excel,单元格中有换行,导入后没有在一个单元格里显示 https://www.tapd.cn/57709429/s/1685274
1 parent 0b60a03 commit 3b24373

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

apps/common/handle/impl/table/xls_parse_table_handle.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,10 @@ def get_content(self, file, save_image):
8282
for row in data:
8383
# 将每个单元格中的内容替换换行符为 <br> 以保留原始格式
8484
md_table += '| ' + ' | '.join(
85-
[str(cell).replace('\n', '<br>') if cell else '' for cell in row]) + ' |\n'
85+
[str(cell)
86+
.replace('\r\n', '<br>')
87+
.replace('\n', '<br>')
88+
if cell else '' for cell in row]) + ' |\n'
8689
md_tables += md_table + '\n\n'
8790

8891
return md_tables

0 commit comments

Comments
 (0)