22#
33# For the full list of built-in configuration values, see the documentation:
44# https://www.sphinx-doc.org/en/master/usage/configuration.html
5+ import os
6+ import sys
7+ import datetime
58
69# -- Project information -----------------------------------------------------
710# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information
11+ current_year = datetime .datetime .now ().year
812
913project = 'TuyaOpen Development Guide'
10- copyright = '2021-%Y , Tuya Inc'
14+ copyright = u '2021-{} , Tuya Inc'. format ( current_year )
1115author = 'Tuya'
12- release = '1.2 .0'
16+ release = '1.3 .0'
1317
1418# -- General configuration ---------------------------------------------------
1519# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
1620
17- # 新增站点地图基础URL配置
18- html_baseurl = 'https://github.com/tuya/TuyaOpen'
21+ html_baseurl = 'https://github.com/tuya/TuyaOpen'
1922
2023extensions = [
2124 'sphinx.ext.autodoc' ,
2730 'sphinxcontrib.mermaid' ,
2831 'sphinx_design' ,
2932 'sphinx_sitemap' ,
30- ]
33+ 'sphinx_multiversion' ,
34+ ]
3135
3236templates_path = ['_templates' ]
3337exclude_patterns = []
3438source_suffix = ['.rst' , '.md' ]
3539
3640language = 'en'
37-
38- # 语法高亮设置
3941pygments_style = 'friendly'
4042
4143html_logo = '../images/TuyaOpen.png'
@@ -50,7 +52,7 @@ def setup(app):
5052html_static_path = ['_static' ]
5153
5254html_theme_options = {
53- # 'display_version': True,
55+ 'display_version' : True ,
5456 'prev_next_buttons_location' : 'both' ,
5557 'style_external_links' : False ,
5658 'sticky_navigation' : True ,
@@ -59,26 +61,33 @@ def setup(app):
5961 'titles_only' : False ,
6062 'collapse_navigation' : False ,
6163 'logo_only' : True ,
62- 'body_max_width' : None , # 取消页面宽度限制
63- 'sidebarwidth' : '25%' , # 调整侧边栏宽度
64+ 'body_max_width' : None ,
65+ 'sidebarwidth' : '25%' ,
6466}
6567
6668html_js_files = [
67- 'js/custom.js' , # 如果有自定义 JavaScript 文件
68- 'js/include_html.js' # 如果需要引入其他 JavaScript 文件
69+ 'js/custom.js' ,
70+ 'js/include_html.js'
6971]
7072
71- # -- GitHub 相关配置 ---------------------------------------------------
7273html_context = {
73- # GitHub 仓库设置(必需)
74- "display_github" : True , # 启用 GitHub 链接
75- "github_user" : "tuya" , # 组织/用户名
76- "github_repo" : "TuyaOpen" , # 仓库名
77- "github_version" : "master" , # 默认分支(如 main/master)
78-
79- # 页面路径配置(自动生成编辑链接)
80- "conf_py_path" : "/docs/en/" , # 配置文件的仓库相对路径
74+ "display_github" : True ,
75+ "github_user" : 'tuya' ,
76+ "github_repo" : 'TuyaOpen' ,
77+ "github_version" : 'master' ,
78+ "conf_py_path" : '/docs/en/' ,
8179}
8280
83- highlight_language = 'c' # 默认高亮C语言代码
84- primary_domain = 'c' # 主文档域为C语言
81+ highlight_language = 'c'
82+ primary_domain = 'c'
83+
84+ # sphinx-multiversion
85+ smv_branch_whitelist = r'^master$' # master only
86+ smv_remote_whitelist = None
87+ smv_tag_whitelist = r'.*'
88+
89+ html_sidebars = {
90+ '**' : [
91+ 'versions.html' ,
92+ ],
93+ }
0 commit comments