mirror of
http://112.124.100.131/huang.ze/ebiz-dify-ai.git
synced 2025-12-11 20:06:54 +08:00
fix: code block segmentation problem of markdown document (#6465)
This commit is contained in:
@@ -54,8 +54,16 @@ class MarkdownExtractor(BaseExtractor):
|
|||||||
|
|
||||||
current_header = None
|
current_header = None
|
||||||
current_text = ""
|
current_text = ""
|
||||||
|
code_block_flag = False
|
||||||
|
|
||||||
for line in lines:
|
for line in lines:
|
||||||
|
if line.startswith("```"):
|
||||||
|
code_block_flag = not code_block_flag
|
||||||
|
current_text += line + "\n"
|
||||||
|
continue
|
||||||
|
if code_block_flag:
|
||||||
|
current_text += line + "\n"
|
||||||
|
continue
|
||||||
header_match = re.match(r"^#+\s", line)
|
header_match = re.match(r"^#+\s", line)
|
||||||
if header_match:
|
if header_match:
|
||||||
if current_header is not None:
|
if current_header is not None:
|
||||||
|
|||||||
Reference in New Issue
Block a user