1. 文档编写说明和示例¶
1.1. 概述¶
- 文档使用sphinx生成,采用reStructuredText标记语言
- 开发人员,新增文档,请才有已有文档结构和文档工具书写
- 文档实例参考
- restructuredtext语法参考
- sphinx官方文档参考
1.2. sphinx编译环境安装¶
编辑保存后执行如下命令,会自动生成html文档
- cd ./docs
- workon skstack 切换到skstack python虚拟机环境,若无情先按照python虚拟机
- pip install -U sphinx 安装sphinx软件
- pip install sphinx_rtd_theme 安装sphinx文档主题
- make html 文档编译测试,没有报错则通过
1.4. 序号和超链接¶
Subtitles are set with ‘-‘ and are required to have the same length of the subtitle itself, just like titles.
1.5. 关键字和代码段落¶
关键字标注
Words can have emphasis in italics or be bold and you can define
code samples with back quotes, like when you talk about a command: sudo
代码段落空行分割且必须缩进”::”两个冒号开始
from bs4 import BeautifulSoup
import scrapy
class ExampleSpider(scrapy.Spider):
name = "example"
allowed_domains = ["example.com"]
start_urls = (
'http://www.example.com/',
)
def parse(self, response):
# use lxml to get decent HTML parsing speed
soup = BeautifulSoup(response.text, 'lxml')
yield {
"url": response.url,
"title": soup.h1.string
}
