Convert a local file or URL to Markdown using MarkItDown.
(source: str)
| 9 | |
| 10 | |
| 11 | def convert_to_markdown(source: str) -> str: |
| 12 | """Convert a local file or URL to Markdown using MarkItDown.""" |
| 13 | if source.startswith(("http://", "https://")): |
| 14 | result = _converter.convert_url(source) |
| 15 | else: |
| 16 | result = _converter.convert_local(source) |
| 17 | return result.markdown |
| 18 | |
| 19 | |
| 20 | async def convert_documents_async(sources: Iterable[str]) -> Dict[str, str]: |
no outgoing calls