(Sphinx标记结构)[ http://HdhCmsTestpythondoc测试数据/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
github上 push 用 sphinx-quickstart 生成的项目, build 目录可以设置到.gitignore中 登录 readthedocs ,注册账号, Connected Services 中授权 github dashboard 中 Import a Porject 导入 github 中的项目然后 build查看更多关于read-the-docs托管学习笔记_html/css_WEB-ITnose的详细内容...
声明:本文来自网络,不代表【好得很程序员自学网】立场,转载请注明出处:http://www.haodehen.cn/did114906