File tree Expand file tree Collapse file tree
src/markitdown/converters Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -84,6 +84,9 @@ def _get_mime_type_prefixes(types: List[DocumentIntelligenceFileType]) -> List[s
8484 prefixes .append (
8585 "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
8686 )
87+ elif type_ == DocumentIntelligenceFileType .HTML :
88+ prefixes .append ("text/html" )
89+ prefixes .append ("application/xhtml+xml" )
8790 elif type_ == DocumentIntelligenceFileType .PDF :
8891 prefixes .append ("application/pdf" )
8992 prefixes .append ("application/x-pdf" )
@@ -119,6 +122,8 @@ def _get_file_extensions(types: List[DocumentIntelligenceFileType]) -> List[str]
119122 extensions .append (".bmp" )
120123 elif type_ == DocumentIntelligenceFileType .TIFF :
121124 extensions .append (".tiff" )
125+ elif type_ == DocumentIntelligenceFileType .HTML :
126+ extensions .append (".html" )
122127 return extensions
123128
124129
Original file line number Diff line number Diff line change 1+ import io
2+ from markitdown .converters ._doc_intel_converter import (
3+ DocumentIntelligenceConverter ,
4+ DocumentIntelligenceFileType ,
5+ )
6+ from markitdown ._stream_info import StreamInfo
7+
8+
9+ def _make_converter (file_types ):
10+ conv = DocumentIntelligenceConverter .__new__ (DocumentIntelligenceConverter )
11+ conv ._file_types = file_types
12+ return conv
13+
14+
15+ def test_docintel_accepts_html_extension ():
16+ conv = _make_converter ([DocumentIntelligenceFileType .HTML ])
17+ stream_info = StreamInfo (mimetype = None , extension = ".html" )
18+ assert conv .accepts (io .BytesIO (b"" ), stream_info )
19+
20+
21+ def test_docintel_accepts_html_mimetype ():
22+ conv = _make_converter ([DocumentIntelligenceFileType .HTML ])
23+ stream_info = StreamInfo (mimetype = "text/html" , extension = None )
24+ assert conv .accepts (io .BytesIO (b"" ), stream_info )
25+ stream_info = StreamInfo (mimetype = "application/xhtml+xml" , extension = None )
26+ assert conv .accepts (io .BytesIO (b"" ), stream_info )
You can’t perform that action at this time.
0 commit comments