Home >Web Front-end >HTML Tutorial >read-the-docs托管学习笔记_html/css_WEB-ITnose

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

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-06-21 08:48:181638browse

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
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn