为Github项目创建文档

时间:2023-03-08 22:28:17

有两种编写方式:

  • In reStructuredText
  • In Markdown

In reStructuredText 

工具:  pip install sphinx sphinx-autobuild

克隆你的仓库到本地:  git clone https://github.com/yourusername/yourrepository.git

在仓库根目录内创建文档:

mkdir docs  & cd docs

sphinx-quickstart   //按照提示一路下去,会生成index.rst和conf.py,以及一些其他的目录和文件

编辑index.rst文件

  Contents:

  Indices and tables

  等

编译html文件  make html

将本地仓库上传到github  git push //输入账号密码


注册并登录Read the Docs

  设置 - Connected to Github   //关联Github账号

开始导入文档

  Import a Project  //会自动列出Github上的仓库名,没有的话也可以手动导入

  按照提示,就可以成功创建了