Skip to content

Commit cc1a063

Browse files
committed
更新文档
1 parent 0cf2e55 commit cc1a063

File tree

7 files changed

+37
-100
lines changed

7 files changed

+37
-100
lines changed

Diff for: doc/conf.py

+11
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
'sphinx_copybutton', # 为代码块添加复制按钮。
3535
"sphinx_comments", # 为 Sphinx 文档添加评论和注释功能。
3636
"sphinx.ext.napoleon", # 支持 Google 和 Numpy 风格的文档字符串
37+
"sphinxcontrib.mermaid",
3738
]
3839

3940
# 在此添加包含模板的任何路径,相对于此目录。
@@ -243,3 +244,13 @@
243244
breathe_projects = { "cpp-examples": "xml/" }
244245

245246
breathe_default_project = "cpp-examples"
247+
248+
249+
# 如果你希望stderr和stdout中的每个输出都被合并成一个流,请使用以下配置。
250+
# 避免将 jupter 执行报错的信息输出到 cmd
251+
nb_merge_streams = True
252+
nb_execution_allow_errors = True
253+
nb_execution_mode = "off"
254+
255+
# 配置mermaid参数
256+
mermaid_params = ['--theme', 'forest']

Diff for: doc/draft/test.rst

-7
This file was deleted.

Diff for: doc/exercises/accumulate.ipynb

+2-29
Original file line numberDiff line numberDiff line change
@@ -9,41 +9,14 @@
99
"{func}`std::accumulate` 是 C++ 标准模板库(STL)中的函数,用于返回一系列值的总和。它接受三个参数:"
1010
]
1111
},
12-
{
13-
"cell_type": "code",
14-
"execution_count": null,
15-
"metadata": {
16-
"vscode": {
17-
"languageId": "plaintext"
18-
}
19-
},
20-
"outputs": [],
21-
"source": [
22-
" std::vector<int> numbers = {1, 2, 3, 4, 5};\n",
23-
"\n",
24-
" int sum = std::accumulate(numbers.begin(), numbers.end(), 0); // sum starts at zero"
25-
]
26-
},
2712
{
2813
"cell_type": "code",
2914
"execution_count": 2,
3015
"metadata": {},
31-
"outputs": [
32-
{
33-
"data": {
34-
"text/plain": [
35-
"15"
36-
]
37-
},
38-
"execution_count": 2,
39-
"metadata": {},
40-
"output_type": "execute_result"
41-
}
42-
],
16+
"outputs": [],
4317
"source": [
4418
"std::vector<int> numbers = {1, 2, 3, 4, 5};\n",
45-
"\n",
46-
"std::accumulate(numbers.begin(), numbers.end(), 0)"
19+
"int sum = std::accumulate(numbers.begin(), numbers.end(), 0); // sum starts at zero"
4720
]
4821
},
4922
{

Diff for: doc/exercises/c2cpp.ipynb

+3-11
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,7 @@
3535
{
3636
"cell_type": "code",
3737
"execution_count": 1,
38-
"metadata": {
39-
"vscode": {
40-
"languageId": "c++"
41-
}
42-
},
38+
"metadata": {},
4339
"outputs": [],
4440
"source": [
4541
"extern \"C\"\n",
@@ -56,11 +52,7 @@
5652
{
5753
"cell_type": "code",
5854
"execution_count": null,
59-
"metadata": {
60-
"vscode": {
61-
"languageId": "c++"
62-
}
63-
},
55+
"metadata": {},
6456
"outputs": [],
6557
"source": []
6658
}
@@ -75,7 +67,7 @@
7567
"codemirror_mode": "text/x-c++src",
7668
"file_extension": ".cpp",
7769
"mimetype": "text/x-c++src",
78-
"name": "C++14",
70+
"name": "c++",
7971
"version": "14"
8072
}
8173
},

Diff for: doc/exercises/cpp2c.ipynb

+4-22
Original file line numberDiff line numberDiff line change
@@ -15,29 +15,10 @@
1515
]
1616
},
1717
{
18-
"cell_type": "code",
19-
"execution_count": 1,
18+
"cell_type": "markdown",
2019
"metadata": {},
21-
"outputs": [
22-
{
23-
"name": "stderr",
24-
"output_type": "stream",
25-
"text": [
26-
"input_line_8:1:10: fatal error: 'cppExample.h' file not found\n",
27-
"#include \"cppExample.h\"\n",
28-
" ^~~~~~~~~~~~~~\n"
29-
]
30-
},
31-
{
32-
"ename": "Interpreter Error",
33-
"evalue": "",
34-
"output_type": "error",
35-
"traceback": [
36-
"Interpreter Error: "
37-
]
38-
}
39-
],
4020
"source": [
21+
"```c\n",
4122
"//C++头文件 cppExample.h\n",
4223
"#ifndef CPP_EXAMPLE_H\n",
4324
"#define CPP_EXAMPLE_H\n",
@@ -59,7 +40,8 @@
5940
"{\n",
6041
" add( 2, 3 ); \n",
6142
" return 0;\n",
62-
"}"
43+
"}\n",
44+
"``"
6345
]
6446
},
6547
{

Diff for: doc/exercises/frexp.ipynb

+13-28
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,17 @@
3434
},
3535
{
3636
"cell_type": "code",
37-
"execution_count": 1,
38-
"metadata": {
39-
"vscode": {
40-
"languageId": "c++"
41-
}
42-
},
37+
"execution_count": 2,
38+
"metadata": {},
39+
"outputs": [],
40+
"source": [
41+
"#include <iostream>"
42+
]
43+
},
44+
{
45+
"cell_type": "code",
46+
"execution_count": 3,
47+
"metadata": {},
4348
"outputs": [
4449
{
4550
"name": "stdout",
@@ -50,9 +55,6 @@
5055
}
5156
],
5257
"source": [
53-
"#include <math.h>\n",
54-
"#include <iostream>\n",
55-
"\n",
5658
"double x, y;\n",
5759
"int n;\n",
5860
"x = 16.4;\n",
@@ -73,27 +75,10 @@
7375
"将双精度有效数字转换为整数有效数字,即将小数点放在第 31 位和第 30 位之间。这是通过将双精度值乘以 $2^{31}$,然后将其转换为 int 来实现的。"
7476
]
7577
},
76-
{
77-
"cell_type": "code",
78-
"execution_count": 3,
79-
"metadata": {
80-
"vscode": {
81-
"languageId": "c++"
82-
}
83-
},
84-
"outputs": [],
85-
"source": [
86-
"significand_d = std::round(significand_d * (1ll << 31));"
87-
]
88-
},
8978
{
9079
"cell_type": "code",
9180
"execution_count": null,
92-
"metadata": {
93-
"vscode": {
94-
"languageId": "c++"
95-
}
96-
},
81+
"metadata": {},
9782
"outputs": [],
9883
"source": []
9984
}
@@ -108,7 +93,7 @@
10893
"codemirror_mode": "text/x-c++src",
10994
"file_extension": ".cpp",
11095
"mimetype": "text/x-c++src",
111-
"name": "C++14",
96+
"name": "c++",
11297
"version": "14"
11398
},
11499
"orig_nbformat": 4

Diff for: pyproject.toml

+4-3
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,14 @@ doc = [
2323
"sphinx",
2424
# "ablog",
2525
"ipywidgets",
26-
"folium",
26+
# "folium",
2727
"numpy",
2828
"matplotlib",
2929
"sphinx-comments",
3030
"myst-nb",
3131
"nbclient",
3232
"pandas",
33-
"plotly",
33+
# "plotly",
3434
"sphinx-design",
3535
"sphinx-examples",
3636
"sphinx-copybutton",
@@ -41,10 +41,11 @@ doc = [
4141
"sphinx-sitemap",
4242
"sphinx-autoapi>=3.4",
4343
"graphviz",
44-
"sphinx-intl", # 文档国际化
44+
# "sphinx-intl", # 文档国际化
4545
"sphinx-tippy",
4646
"taolib[flows]",
4747
"breathe",
48+
"sphinxcontrib-mermaid",
4849
]
4950

5051
flows = [

0 commit comments

Comments
 (0)