Python convert sphinx RST to HTML
问题 I have tried this code: from docutils.core import publish_string text = publish_string(open(file_path, 'r').read(), writer_name='html') But it says: <p>Unknown directive type "toctree".</p> So it won't work with some specific sphinx directives. What is the easiest way to do same stuff for sphinx RST files? upd. Seems like it must be: sphinx-build -b singlehtml -D extensions='sphinx.ext.autodoc' -D master_doc='index' -C /mypath/docs . How can I call that from Python code instead of console?