语法餐卡 https://docutils.sourceforge.io/docs/ref/rst/directives.html =============== Style Sample =============== :ref:`内部跳转` 章节段落是相对的,上下级是相对关系,不是绝对关系。 章节 ==== H1 标题 ========== H2 标题 ---------- H3 标题 ^^^^^^^^^^ H4 标题 :::::::::: H5 标题 ********** H6 标题 ++++++++++ :: H1 标题 ========== H2 标题 ---------- H3 标题 ^^^^^^^^^^ H4 标题 :::::::::: H5 标题 ********** H6 标题 ++++++++++ 内联标记 ======== *斜体* **加粗** ``代码`` \\\*\:\_特殊字符 :: *斜体* **加粗** ``代码`` \\\*\:\_特殊字符,转义符\ 列表与引用 ========== * 这是一个项目符号列表. * 它有两项, 第二项使用两行. 1. 这是个有序列表. 2. 也有两项. #. 是个有序列表. #. 也有两项. :: * 这是一个项目符号列表. * 它有两项, 第二项使用两行. 1. 这是个有序列表. 2. 也有两项. #. 是个有序列表. #. 也有两项. * 这是 * 一个列表 * 嵌套列表 * 子项 * 父列表继续 :: * 这是 * 一个列表 * 嵌套列表 * 子项 * 父列表继续 | 这些行 | 在源文件里 | 被分隔的一模一样. :: | 这些行 | 在源文件里 | 被分隔的一模一样. 源代码 ====== 这是一段正常文本. 下一段是代码文字:: 它不需要特别处理,仅是 缩进就可以了. 它可以有多行. 再是正常的文本段. .. code-block:: python def foo(x,y) return x,y .. code-block:: cpp void main() int a = 0; return a; :: 这是一段正常文本. 下一段是代码文字:: 它不需要特别处理,仅是 缩进就可以了. 它可以有多行. 再是正常的文本段. .. code-block:: python def foo(x,y) return x,y .. code-block:: cpp void main() int a = 0; return a; 表格 ==== reStauctedText对于表格的绘制比较麻烦,表格线对齐有比较严格的要求,这边编辑器里面一定要用中英文等宽字体才能比较好的解决对齐的问题。建议使用 ``Sarasa Mono SC`` 自定义表格 +------------------------+------------+----------+----------+ | Header row, column 1 | Header 2 | Header 3 | Header 4 | | (header rows optional) | | | | +========================+============+==========+==========+ | body row 1, column 1 | column 2 | column 3 | column 4 | +------------------------+------------+----------+----------+ | body row 2 | ... | ... | | +------------------------+------------+----------+----------+ :: +------------------------+------------+----------+----------+ | Header row, column 1 | Header 2 | Header 3 | Header 4 | | (header rows optional) | | | | +========================+============+==========+==========+ | body row 1, column 1 | column 2 | column 3 | column 4 | +------------------------+------------+----------+----------+ | body row 2 | ... | ... | | +------------------------+------------+----------+----------+ 简单表格 ===== ===== ======= A B A and B ===== ===== ======= False False False True False False False True False True True True ===== ===== ======= :: ===== ===== ======= A B A and B ===== ===== ======= False False False True False False False True False True True True ===== ===== ======= 超链接 ====== `百度超链接`_ .. _百度超链接: http://www.baidu.com/ :: `百度`_ .. _百度: http://www.baidu.com/ .. _内部跳转: 内部跳转章节 ------------- 章节内容. 指令 ==== 警告 ---- .. attention:: attention .. caution:: caution .. danger:: danger .. error:: error .. hint:: hint .. important:: important .. note:: note .. tip:: tip .. warning:: warning :: .. attention:: attention .. caution:: caution .. danger:: danger .. error:: error .. hint:: hint .. important:: important .. note:: note .. tip:: tip .. warning:: warning 图片 ---- .. image:: logo.png .. figure:: logo.png 有标题及可选说明的图像 专用指令 -------- :: .. include:: index.rst .. function:: foo(x) foo(y, z) :module: some.module.name 返回用户输入的一行文本. 尾注 ==== 第一条尾注的文本 [#f1]_ 第二条尾注的文本 [#f2]_ .. rubric:: Footnotes .. [#f1] 第一条尾注的文本. .. [#f2] 第二条尾注的文本. :: 第一条尾注的文本 [#f1]_ 第二条尾注的文本 [#f2]_ .. rubric:: Footnotes .. [#f1] 第一条尾注的文本. .. [#f2] 第二条尾注的文本. 引用 ==== Lorem ipsum [Ref]_ dolor sit amet. .. [Ref] 参考文献, 书,URL 等. :: Lorem ipsum [Ref]_ dolor sit amet. .. [Ref] 参考文献, 书,URL 等. 替换 ==== |name| |caution| .. |name| replace:: replacement *text* .. |caution| image:: logo.png :alt: Warning! :: |name| |caution| .. |name| replace:: replacement *text* .. |caution| image:: logo.png :alt: Warning! 注释 ==== :: .. 这是一个注释. .. 这整个缩进块都是 一个注释. 仍是一个注释.