I had it generating .docx the other day and it did pretty well, so I assume it understands the format just fine.
And they're excellent at markdown.
https://gist.github.com/plembo/409a8d7b1bae66622dbcd26337bbb...
Microsoft OSS python: https://github.com/microsoft/markitdown
There seem to be many addons that enable this, and pandoc as others have suggested