my_study_rst’s 学习笔记¶
我自己对rst文档的学习笔记
段落学习¶
段落是被空行分割的文字片段,左侧必须对齐(没有空格,或者有相同多的空格)。
缩进的段落被视为引文。
缩进的段落会被视为引文 缩进的段落会被视为引文 缩进的段落会被视为引文 缩进的段落会被视为引文 缩进的段落会被视为引文 缩进的段落会被视为引文 缩进的段落会被视为引文 缩进的段落会被视为引文
表格学习¶
格网表格¶
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 |
替换引用和定义¶
这个 符号是替换的
代码块¶
bash代码样例¶
#!/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
python代码样例¶
try:
f = open('/path/to/file', 'r')
print(f.read())
finally:
if f:
f.close()
with open('/path/to/file', 'r') as f:
print(f.read())
f = open('/Users/michael/gbk.txt', 'r', encoding='gbk', errors='ignore')
json对象样例展示¶
{
"name": "BeJson",
"url": "http://www.bejson.com",
"page": 88,
"isNonProfit": true,
"address": {
"street": "科技园路.",
"city": "江苏苏州",
"country": "中国"
},
"links": [
{
"name": "Google",
"url": "http://www.google.com"
},
{
"name": "Baidu",
"url": "http://www.baidu.com"
},
{
"name": "SoSo",
"url": "http://www.SoSo.com"
}
]
}
toctree¶
toctree的用法,可以参考如下 my_study_rst’s 学习笔记 的文档源码即可。
这里主要说下几个重要的参数。
: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¶
/sphinx标记结构/test.csv
段落级别标记¶
注解
这是note
警告
这是warning
2.5 新版功能.
在 2.6 版更改.
1.0 版后已移除.
参见
这是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
显示代码¶
注解
我们可以在配置文件指定highlight_langeuage=”c,python”
使用codeblock¶
#include<stdio.h>
int main()
{
printf("%s\n","aaaa");
return 0;
}
显示行号¶
1 2 3 4 5 6 | #include<stdio.h>
int main()
{
printf("%s\n","aaaa");
return 0;
}
|
突出特定行¶
def some_function():
interesting = False
print 'This line is highlighted.'
print 'This one is not...'
print '...but this one is.'
引用一个文件¶
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/myrst/checkouts/latest/source/Sphinx标记结构/test2.py
+++ /home/docs/checkouts/readthedocs.org/user_builds/myrst/checkouts/latest/source/Sphinx标记结构/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")
其他标记¶
字段标记¶
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! |