convert_doc#

dscat.docs.convert_doc(src, dest, engine=None)[source]#

Convert src to markdown at dest with engine, caching by mtime.

Parameters:
  • src (pathlib.Path) – The source document.

  • dest (pathlib.Path) – Where to write the markdown. A dest newer than src is reused as is.

  • engine (sqlalchemy.engine.Engine or None, default None) – Force a conversion engine. When None the engine is chosen by file type: marker for PDFs, markitdown otherwise, and textutil for legacy .doc/.rtf (see resolve_engine()).

Returns:

dest.

Return type:

pathlib.Path

Raises:

RuntimeError – When the engine cannot convert the document, for example because its tool is not installed or it does not support the document’s format.