async def _handle_extract_file(self, input_file: str | PathLike[str]) -> str:
        """Extract text content from a file using Pandoc.

        Args:
            input_file: The file to extract content from

        Returns:
            The extracted text content

        Raises:
            ParsingError: If content extraction fails
        """
        pandoc_type = self._get_pandoc_type_from_mime_type(self.mime_type)
        output_path, unlink = await create_temp_file(".md")
        try:
            command = [
                "pandoc",
                str(input_file),
                f"--from={pandoc_type}",
                "--to=markdown",
                "--standalone",
                "--wrap=preserve",
                "--quiet",
            ]

            command.extend(["--output", str(output_path)])

            result = await run_process(command)

            if result.returncode != 0:
                raise ParsingError(
                    "Failed to extract file data", context={"file": str(input_file), "error": result.stderr}
                )

            text = await AsyncPath(output_path).read_text("utf-8")

            return normalize_spaces(text)
        except (RuntimeError, OSError) as e:
            raise ParsingError("Failed to extract file data", context={"file": str(input_file)}) from e
        finally:
            await unlink()
Extract text content from a file using Pandoc.

        Args:
            input_file: The file to extract content from

        Returns:
            The extracted text content

        Raises:
            ParsingError: If content extraction fails
        
kreuzberg/_extractors/_pandoc.py