python .rst转.html

#先安装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了~

转载于:https://www.cnblogs.com/edwar172038/p/10509614.html

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值