1. 文档编写说明和示例

1.1. 概述

  1. 文档使用sphinx生成,采用reStructuredText标记语言
  2. 开发人员,新增文档,请才有已有文档结构和文档工具书写
  3. 文档实例参考
  4. restructuredtext语法参考
  5. sphinx官方文档参考

1.2. sphinx编译环境安装

编辑保存后执行如下命令,会自动生成html文档

  1. cd ./docs
  2. workon skstack 切换到skstack python虚拟机环境,若无情先按照python虚拟机
  3. pip install -U sphinx 安装sphinx软件
  4. pip install sphinx_rtd_theme 安装sphinx文档主题
  5. make html 文档编译测试,没有报错则通过

1.3. sphinx文档更新命令

编辑保存后执行如下命令,会自动生成html文档

  1. cd ./docs
  2. workon skstack
  3. make html

1.4. 序号和超链接

Subtitles are set with ‘-‘ and are required to have the same length of the subtitle itself, just like titles.

1.4.1. 序号

点号list:

  • Item Foo
  • Item Bar

序号list:

  1. Item 1
  2. Item 2

1.4.2. 超链接

语法`链接文字 <URL>`_

语法参考:

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
            }

1.6. 图片和提示

图片

image not found

提示

注解

这是一个注意提示

警告

这是一个告警提示