标签:重要 command 直接 module template 执行 tor check from
#先安装lib库
pip install sphinx
创建一个文件夹,随便名字,例如 test
cmd中执行命令
sphinx-quickstart > Root path for the documentation [.]: doc # 在当前目录下新建doc文件夹存放sphinx相关信息 > Separate source and build directories (y/n) [n]: # 默认,直接回车 > Name prefix for templates and static dir [_]: > Project name: python123 # 输入项目名称 > Author name(s): 123 # 作者 > Project version: 1.0 # 项目版本 > Project release [1.0]: > Project language [en]: # 默认,回车 > Source file suffix [.rst]: > Name of your master document (without suffix) [index]: > Do you want to use the epub builder (y/n) [n]: > autodoc: automatically insert docstrings from modules (y/n) [n]: y # 这个很重要,输入y > doctest: automatically test code snippets in doctest blocks (y/n) [n]: > intersphinx: link between Sphinx documentation of different projects (y/n) [n]: > todo: write "todo" entries that can be shown or hidden on build (y/n) [n]: > coverage: checks for documentation coverage (y/n) [n]: > pngmath: include math, rendered as PNG images (y/n) [n]: > mathjax: include math, rendered in the browser by MathJax (y/n) [n]: > ifconfig: conditional inclusion of content based on config values (y/n) [n]: > viewcode: include links to the source code of documented Python objects (y/n) [n]: y # 很重要,输入y,表示将源码也放到文档中,你看很多python的模块的文档,其实都是包含代码的。 > Create Makefile? (y/n) [y]: > Create Windows command file? (y/n) [y]:
会新增一个doc文件夹,目录结构
将需要转的rst文件复制到doc文件夹里面 改明为index.rst 如果不想改名字 就到conf.py里面改下配置文件
_build中就为需要的html了~
标签:重要 command 直接 module template 执行 tor check from
原文地址:https://www.cnblogs.com/edwar172038/p/10509614.html