RST学习笔记¶
rst 学习笔记, 在根节点的rst文件表示主页面,其中相关的布局代表着整个封面,其中可以采取嵌入式的toctree方式,这种的的效果是左边的目录栏,只显示根
基础语法¶
这是一个测试
标题学习¶
example:
二级标题
==========
----------
三级标题
----------
四级标题
----------
`````````
五级标题
`````````
六级标题
`````````
效果:
中级语法¶
这是一个测试
表格学习¶
格网表格¶
Header 1 | Header 2 | Header 3 |
---|---|---|
body row 1 | column 2 | column 3 |
body row 2 | Cells may span columns. | |
body row 3 | Cells may span rows. |
|
body row 4 |
替换引用和定义¶
这个 符号是替换的
code-line¶
bash代码样例¶
.. code-block:: bash
:linenos:
:emphasize-lines: 3,5
#!/bin/bash
#================================================
#FileName :test_select_46_zhaojiedi.sh
#Author :zhaojiedi
#Description:
#DateTime :2017-12-23 10:15:57
#Version :V1.0
#Other :
#================================================
select c in yes no ; do
echo " you enter is $c"
case $c in
yes)
echo "yes";;
no)
echo "no";;
*)
echo "other";;
esac
done
效果:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | #!/bin/bash
#================================================
#FileName :test_select_46_zhaojiedi.sh
#Author :zhaojiedi
#Description:
#DateTime :2017-12-23 10:15:57
#Version :V1.0
#Other :
#================================================
select c in yes no ; do
echo " you enter is $c"
case $c in
yes)
echo "yes";;
no)
echo "no";;
*)
echo "other";;
esac
done
|
Note
其支持的语言有python、bash、json、ruby. 附加参数: :linenos: 显示行号
Note
我们可以在配置文件指定highlight_langeuage=”c,python”
code-block¶
bash代码样例¶
.. code-block:: bash
:linenos:
:emphasize-lines: 3,5
#!/bin/bash
#================================================
#FileName :test_select_46_zhaojiedi.sh
#Author :zhaojiedi
#Description:
#DateTime :2017-12-23 10:15:57
#Version :V1.0
#Other :
#================================================
select c in yes no ; do
echo " you enter is $c"
case $c in
yes)
echo "yes";;
no)
echo "no";;
*)
echo "other";;
esac
done
效果:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | #!/bin/bash
#================================================
#FileName :test_select_46_zhaojiedi.sh
#Author :zhaojiedi
#Description:
#DateTime :2017-12-23 10:15:57
#Version :V1.0
#Other :
#================================================
select c in yes no ; do
echo " you enter is $c"
case $c in
yes)
echo "yes";;
no)
echo "no";;
*)
echo "other";;
esac
done
|
Note
其支持的语言有python、bash、json、ruby. 附加参数: :linenos: 显示行号
Note
我们可以在配置文件指定highlight_langeuage=”c,python”
code-file¶
有些时候需要显示的代码来自某个文件或者某个url,以及显示出两个文件的差异
引用一个文件¶
1 2 3 4 5 6 7 8 9 10 11 | import sys
print("test")
def test2():
print("test")
def test3():
print("test")
def test4():
print("test")
|
diff2个文件¶
--- /home/docs/checkouts/readthedocs.org/user_builds/rstd/checkouts/latest/_static/test2.py
+++ /home/docs/checkouts/readthedocs.org/user_builds/rstd/checkouts/latest/_static/test.py
@@ -1,12 +1,13 @@
import sys
-import os
def test1():
- print("test3")
+ print("test")
def test2():
- print("test2")
+ print("test")
+def test3():
+ print("test")
def test4():
- print("test4")+ print("test")
Sphinx标记结构¶
这是一个测试
toctree¶
toctree的用法,可以参考如下 RST学习笔记 的文档源码即可。
这里主要说下几个重要的参数。
:maxdepth:2 设置最大深度
:numbered: 自动编号
:name: 名字
:titlesonly: 只显示标题
:glob: 通配符,这样写文件条目简单写
:reversed: 反向编号
:hidden: 隐藏
样例
.. toctree::
:glob:
:reversed:
:numbered:
:caption: test
docdir1/*
docdir2/*
内联标记¶
ref¶
这个ref就是引用本项目的其他文档的连接的,需要在一个文档的顶部设置.. _topics-youindex_name:,
在另一个文档使用 :ref:`topics-youindex_name`。
download¶
段落级别标记¶
Note
这是note
Warning
这是warning
New in version 2.5.
Changed in version 2.6.
Deprecated since version 1.0.
See also
这是seealso
这是rubric
LICENSE AGREEMENT
|
|
|
表内容标记¶
- environment
- A structure where information about all documents under the root is saved, and used for cross-referencing. The environment is pickled after the parsing stage, so that successive runs only need to read and parse new and changed documents.
- source directory
- The directory which, including its subdirectories, contains all source files for one Sphinx project.
- term 1
- term 2
- Definition of both terms.
try_stmt ::= try1_stmt | try2_stmt try1_stmt ::= "try" ":"suite
("except" [expression
[","target
]] ":"suite
)+ ["else" ":"suite
] ["finally" ":"suite
] try2_stmt ::= "try" ":"suite
"finally" ":"suite
其他标记¶
字段标记¶
fieldname: | name |
---|---|
fieldname: | age |
fieldanme: | getAge() |
csv表格¶
Treat | Quantity | Description |
---|---|---|
Albatross | 2.99 | On a stick! |
Crunchy Frog | 1.49 | If we took the bones out, it wouldn’t be crunchy, now would it? |
Gannet Ripple | 1.99 | On a stick! |