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

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

WBOY
Release: 2016-06-21 08:48:18
Original
1601 people have browsed it

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

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

Sphinx安装

pip install sphinx sphinx-autobuild
Copy after login

快速开始

#创建目录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
Copy after login

添加一篇文章

在 source 目录下新建 hello.rst :

hello,world======================================
Copy after login

index.rst修改如下:

Contents:.. toctree::   :maxdepth: 2   hello
Copy after login

make html 后效果如下:

支持markdown编写

pip install recommonmark
Copy after login

更改conf.py:

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

更改主题 sphinx_rtd_theme

pip install sphinx_rtd_theme
Copy after login

更改conf.py:

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

Github托管, read_the_docs发布

doc

  1. github上 push 用 sphinx-quickstart 生成的项目, build 目录可以设置到.gitignore中
  2. 登录 readthedocs ,注册账号, Connected Services 中授权 github
  3. dashboard 中 Import a Porject 导入 github 中的项目然后 build
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template