5. 显示代码¶
注解
我们可以在配置文件指定highlight_langeuage=”c,python”
5.1. 使用codeblock¶
#include<stdio.h>
int main()
{
printf("%s\n","aaaa");
return 0;
}
5.2. 显示行号¶
1 2 3 4 5 6 | #include<stdio.h>
int main()
{
printf("%s\n","aaaa");
return 0;
}
|
5.3. 突出特定行¶
def some_function():
interesting = False
print 'This line is highlighted.'
print 'This one is not...'
print '...but this one is.'
5.4. 引用一个文件¶
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")
|
5.5. 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")