PHP8.1.21版本已发布
vue8.1.21版本已发布
jquery8.1.21版本已发布

read-the-docs托管学习笔记_html/css_WEB-ITnose

原创
2016-06-21 08:48:18 1305浏览

Sphinx 是一个基于Python的文档生成项目,采用了 reStructuredText 作为文档写作语言 ,不过也可以通过模块支持其他格式.

(Sphinx标记结构)[ http://www.pythondoc.com/sphinx/markup/ ]

Sphinx安装

pip install sphinx sphinx-autobuild

快速开始

#创建目录cd /path/to/projectmkdir docs#sphinx工作目录基本配置cd docs#可以回车按默认配置来写sphinx-quickstart#quickstart 后生成的目录结构readthedocs│ make.bat│ Makefile├─build└─source  │ conf.py  │ index.rst  ├─_static  └─_templates# 默认会有一个index.rst,make html用来生成html页面make html

添加一篇文章

在 source 目录下新建 hello.rst :

hello,world======================================

index.rst修改如下:

Contents:.. toctree::   :maxdepth: 2   hello

make html 后效果如下:

支持markdown编写

pip install recommonmark

更改conf.py:

from recommonmark.parser import CommonMarkParsersource_parsers = {    '.md': CommonMarkParser,}source_suffix = ['.rst', '.md']

更改主题 sphinx_rtd_theme

pip install sphinx_rtd_theme

更改conf.py:

import sphinx_rtd_themehtml_theme = "sphinx_rtd_theme"html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]

Github托管, read_the_docs发布

doc

  1. github上 push 用 sphinx-quickstart 生成的项目, build 目录可以设置到.gitignore中
  2. 登录 readthedocs ,注册账号, Connected Services 中授权 github
  3. dashboard 中 Import a Porject 导入 github 中的项目然后 build
声明:本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn核实处理。