@@ -1095,12 +1095,11 @@ def to_markdown(self, file_paths: dict, format: str) -> None:
10951095 for doc_path_set in file_paths [Category .DOCUMENT ]:
10961096 if doc_path_set [2 ] == "docx" :
10971097 docx_path = self ._join_back (doc_path_set )
1098- # Output paths
10991098 output_basename = doc_path_set [1 ]
11001099 md_path = os .path .abspath (os .path .join (self .output , f"{ output_basename } .{ format } " ))
1101- image_dir = os .path .join (self .output , f"{ output_basename } _images" )
1102- os .makedirs (image_dir , exist_ok = True )
1103- # Extract images manually
1100+ image_md_dir = os .path .join (self .output , f"{ output_basename } _images" )
1101+ os .makedirs (image_md_dir , exist_ok = True )
1102+ # Extract images
11041103 doc = docx .Document (docx_path )
11051104 image_markdown = []
11061105 image_index = 0
@@ -1109,7 +1108,7 @@ def to_markdown(self, file_paths: dict, format: str) -> None:
11091108 image_data = rel .target_part .blob
11101109 image_ext = rel .target_part .content_type .split ("/" )[- 1 ]
11111110 image_filename = f"{ output_basename } _{ image_index } .{ image_ext } "
1112- image_path = os .path .join (image_dir , image_filename )
1111+ image_path = os .path .join (image_md_dir , image_filename )
11131112 with open (image_path , "wb" ) as img_file :
11141113 img_file .write (image_data )
11151114 # Use relative path for Markdown image tag
0 commit comments