def rst2dtree(rst):
err = io.StringIO()
with contextlib.redirect_stderr(err):
try:
dtree = docutils.core.publish_doctree(rst)
except docutils.utils.SystemMessage as e:
dtree = None
print("parsing failed", e)
return err.getvalue(), dtree
评论列表
文章目录