We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 8a9d8f1 commit b86f139Copy full SHA for b86f139
1 file changed
packages/markitdown/src/markitdown/converters/_docx_converter.py
@@ -84,7 +84,15 @@ def convert(
84
85
style_map = kwargs.get("style_map", None)
86
pre_process_stream = pre_process_docx(file_stream)
87
- return self._html_converter.convert_string(
88
- mammoth.convert_to_html(pre_process_stream, style_map=style_map).value,
89
- **kwargs,
90
- )
+
+ # Patch: handle missing styleId safely
+ try:
+ html = mammoth.convert_to_html(pre_process_stream, style_map=style_map).value
91
+ except KeyError as e:
92
+ if str(e) == "'w:styleId'":
93
+ # Ignore missing style IDs and convert anyway
94
+ html = mammoth.convert_to_html(pre_process_stream, style_map=style_map, ignore_empty_styles=True).value
95
+ else:
96
+ raise
97
98
+ return self._html_converter.convert_string(html, **kwargs)
0 commit comments