Skip to content

Commit bf4afde

Browse files
committed
feat(docs): 更新文档配置并优化构建设置
- 将版本号从 0.1.0 更新为 1.0 - 重构路径配置以使用统一的仓库根目录变量 - 调整模板路径指向父级 templates 目录 - 调整静态文件路径指向父级 static 目录 - 添加 Python 官方文档的 intersphinx 链接映射 - 重新配置 autodoc 扩展选项以改善文档生成质量 - 启用 autosectionlabel 扩展以支持跨文档章节引用 - 禁用继承文档字符串以避免重复显示方法定义
1 parent 3f0e717 commit bf4afde

2 files changed

Lines changed: 18 additions & 13 deletions

File tree

docs/source/conf.py

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,11 @@
1313
project = 'MCDR-Plugins'
1414
copyright = f'{datetime.datetime.now().year}, xieyuen'
1515
author = 'xieyuen'
16-
release = '0.1.0'
16+
release = '1.0.0'
1717

18-
src = Path(__file__).parent.parent.parent / "src"
19-
dependencies = Path(__file__).parent.parent.parent / "dependencies"
18+
repo_root = Path(__file__).parent.parent.parent
19+
src = repo_root / "src"
20+
dependencies = repo_root / "dependencies"
2021

2122
for directory in src.iterdir():
2223
sys.path.append(str(directory))
@@ -52,7 +53,7 @@
5253
'sphinxcontrib.asciinema'
5354
]
5455

55-
templates_path = ['_templates']
56+
templates_path = ['../templates']
5657
exclude_patterns = []
5758

5859
language = 'zh_CN'
@@ -61,23 +62,27 @@
6162
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output
6263

6364
html_theme = 'sphinx_rtd_theme'
64-
html_static_path = ['_static']
65+
html_static_path = ['../static']
6566
html_css_files = ['custom.css']
6667

6768
# -- extension configuations -------------------------------------------------
6869

6970
# 常用的外部文档链接映射
7071
intersphinx_mapping = {
7172
'mcdreforged': ('https://docs.mcdreforged.com/zh-cn/latest/', None),
73+
'python': ('https://docs.python.org/3', None),
7274
}
73-
autodoc_default_options = {
74-
'members': True, # 显示所有成员
75-
'member-order': 'bysource', # 按源代码顺序
76-
'special-members': '__init__', # 显示特殊方法
77-
'undoc-members': True, # 显示没有文档的成员
78-
'show-inheritance': True, # 显示继承关系
79-
}
80-
# napoleon_use_ivar = True # 使用 :ivar: 而不是生成独立的属性文档
75+
76+
# -- Options for sphinx.ext.autodoc -------------------------------------------------
77+
# https://www.sphinx-doc.org/en/master/usage/extensions/autodoc.html
78+
autodoc_member_order = 'bysource'
79+
autodoc_inherit_docstrings = False # so overridden methods won't pop up
80+
81+
82+
# -- Options for sphinx.ext.autosectionlabel -------------------------------------------------
83+
# https://www.sphinx-doc.org/en/master/usage/extensions/autosectionlabel.html
84+
autosectionlabel_prefix_document = True
85+
8186

8287
# 删除线样式
8388
rst_prolog = """

0 commit comments

Comments
 (0)