huhan3000/documentation/sphinx-docs/conf.py

121 lines
2.7 KiB
Python

# Configuration file for the Sphinx documentation builder.
#
# 胡汉三千年项目文档配置
# Hu-Han Three Thousand Years Project Documentation Configuration
import os
import sys
# 添加项目根目录到Python路径
sys.path.insert(0, os.path.abspath('../../'))
# -- Project information -----------------------------------------------------
project = '胡汉三千年 (Hu-Han Three Thousand Years)'
copyright = '2025, 胡汉三千年项目组'
author = '胡汉三千年项目组'
release = '1.0.0'
version = '1.0'
# -- General configuration ---------------------------------------------------
extensions = [
'sphinx.ext.autodoc',
'sphinx.ext.viewcode',
'sphinx.ext.napoleon',
'sphinx.ext.intersphinx',
'sphinx.ext.todo',
'sphinx.ext.coverage',
'sphinx.ext.mathjax',
'sphinx.ext.ifconfig',
'sphinx.ext.githubpages',
'myst_parser', # 支持Markdown
]
# 支持的文件格式
source_suffix = {
'.rst': None,
'.md': 'myst_parser',
}
templates_path = ['_templates']
exclude_patterns = [
'_build',
'Thumbs.db',
'.DS_Store',
'config',
'tools',
'**.ipynb_checkpoints'
]
# 语言设置
language = 'zh_CN'
# -- Options for HTML output -------------------------------------------------
html_theme = 'sphinx_rtd_theme' # 使用更现代的主题
html_static_path = ['_static']
# 主题配置
html_theme_options = {
'analytics_id': '',
'logo_only': False,
'display_version': True,
'prev_next_buttons_location': 'bottom',
'style_external_links': False,
'collapse_navigation': True,
'sticky_navigation': True,
'navigation_depth': 4,
'includehidden': True,
'titles_only': False
}
# 网站图标
html_favicon = None
# 侧边栏
html_sidebars = {
'**': [
'relations.html', # needs 'show_related': True theme option to display
'searchbox.html',
]
}
# -- Extension configuration -------------------------------------------------
# Napoleon settings
napoleon_google_docstring = True
napoleon_numpy_docstring = True
napoleon_include_init_with_doc = False
napoleon_include_private_with_doc = False
napoleon_include_special_with_doc = True
napoleon_use_admonition_for_examples = False
napoleon_use_admonition_for_notes = False
napoleon_use_admonition_for_references = False
napoleon_use_ivar = False
napoleon_use_param = True
napoleon_use_rtype = True
# Todo extension
todo_include_todos = True
# Intersphinx mapping
intersphinx_mapping = {
'python': ('https://docs.python.org/3/', None),
}
# MyST Parser configuration
myst_enable_extensions = [
"amsmath",
"colon_fence",
"deflist",
"dollarmath",
"html_admonition",
"html_image",
"linkify",
"replacements",
"smartquotes",
"substitution",
"tasklist",
]