Custom mammoth image converter with compression.
(image)
| 101 | |
| 102 | |
| 103 | def _mammoth_convert_image(image): |
| 104 | """Custom mammoth image converter with compression.""" |
| 105 | with image.open() as f: |
| 106 | image_bytes = f.read() |
| 107 | alt_text = image.alt_text or "" |
| 108 | result = _compress_image(image_bytes, image.content_type, alt_text) |
| 109 | if not result: |
| 110 | return {} |
| 111 | return result |
| 112 | |
| 113 | |
| 114 | def docx_to_markdown(docx_path: str) -> str: |
nothing calls this directly
no test coverage detected