99# If extensions (or modules to document with autodoc) are in another directory,
1010# add these directories to sys.path here. If the directory is relative to the
1111# documentation root, use os.path.abspath to make it absolute, like shown here.
12- #
13- # import os
14- # import sys
15- # sys.path.insert(0, os.path.abspath('.'))
1612
13+ import os
14+ import sys
15+ import ablog
16+
17+ if sys .platform == 'win32' :
18+ import asyncio
19+ asyncio .set_event_loop_policy (asyncio .WindowsSelectorEventLoopPolicy ())
20+
21+ sys .path .insert (0 , os .path .abspath ('.' ))
1722
1823# -- Project information -----------------------------------------------------
1924
20- project = 'sphinx demo'
25+ project = 'sphinx- demo'
2126copyright = '2021, xinetzone'
2227author = 'xinetzone'
2328
2429# The full version, including alpha/beta/rc tags
25- release = '0.0.1'
26-
30+ release = '0.1'
2731
2832# -- General configuration ---------------------------------------------------
2933
3034# Add any Sphinx extension module names here, as strings. They can be
3135# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
3236# ones.
3337extensions = [
34- 'myst_parser'
38+ "sphinx_book_theme" ,
39+ "ablog" ,
40+ "myst_nb" ,
41+ "sphinx.ext.extlinks" ,
42+ "sphinx.ext.intersphinx" ,
43+ "sphinx_thebe" ,
44+ "sphinx_copybutton" ,
45+ "sphinx_comments" ,
46+ "sphinxcontrib.mermaid" ,
47+ # "sphinx.ext.todo",
48+ # "sphinxcontrib.bibtex",
49+ # "sphinx_togglebutton",
50+ # "sphinx.ext.viewcode",
51+ # "sphinx.ext.autodoc",
52+ # "sphinx.ext.doctest",
53+ # "sphinx_design",
54+ # "sphinx.ext.ifconfig",
55+ # "sphinx_automodapi.automodapi",
56+ # "sphinxext.opengraph",
3557]
3658
37- source_suffix = {
38- '.rst' : 'restructuredtext' ,
39- '.md' : 'markdown' ,
59+ myst_enable_extensions = [
60+ "colon_fence" ,
61+ "amsmath" ,
62+ "deflist" ,
63+ "dollarmath" ,
64+ "html_admonition" ,
65+ "html_image" ,
66+ "replacements" ,
67+ "smartquotes" ,
68+ "substitution" ,
69+ "tasklist" ,
70+ # "linkify",
71+ ]
72+
73+ comments_config = {
74+ "hypothesis" : True ,
75+ "dokieli" : False ,
76+ "utterances" : {
77+ "repo" : "xinetzone/sphinx-demo" ,
78+ "optional" : "config" ,
79+ }
80+ }
81+
82+ # MyST NB 设置
83+ nb_render_priority = {
84+ "html" : (
85+ "application/vnd.jupyter.widget-view+json" ,
86+ "application/javascript" ,
87+ "text/html" ,
88+ "image/svg+xml" ,
89+ "image/png" ,
90+ "image/jpeg" ,
91+ "text/markdown" ,
92+ "text/latex" ,
93+ "text/plain" ,
94+ ),
95+ 'gettext' : ()
96+ }
97+
98+ extlinks = {
99+ # 'duref': ('https://docutils.sourceforge.io/docs/ref/rst/'
100+ # 'restructuredtext.html#%s', ''),
101+ # 'durole': ('https://docutils.sourceforge.io/docs/ref/rst/'
102+ # 'roles.html#%s', ''),
103+ # 'dudir': ('https://docutils.sourceforge.io/docs/ref/rst/'
104+ # 'directives.html#%s', ''),
105+ 'py-doc' : ('https://daobook.github.io/cpython/%s' , '' ),
106+ 'github' : ('https://github.com/%s' , '' ),
107+ 'daobook' : ('https://daobook.github.io/%s' , '' ),
108+ 'ablog' : ('https://daobook.github.io/ablog/zh-CN/%s' , '' )
109+ }
110+
111+ intersphinx_mapping = {
112+ 'python' : ('https://daobook.github.io/cpython/' , None ),
113+ 'sphinx' : ('https://daobook.github.io/sphinx/' , None ),
114+ 'peps' : ('https://daobook.github.io/peps' , None ),
40115}
41116
42117# Add any paths that contain templates here, relative to this directory.
43- templates_path = ['_templates' ]
118+ templates_path = ['_templates' , ablog . get_html_templates_path () ]
44119
45120# The language for content autogenerated by Sphinx. Refer to documentation
46121# for a list of supported languages.
54129# This pattern also affects html_static_path and html_extra_path.
55130exclude_patterns = ['_build' , 'Thumbs.db' , '.DS_Store' ]
56131
57-
58132# -- Options for HTML output -------------------------------------------------
59133
60134# The theme to use for HTML and HTML Help pages. See the documentation for
61135# a list of builtin themes.
62136#
63- html_theme = 'furo '
137+ html_theme = 'sphinx_book_theme '
64138
65139# Add any paths that contain custom static files (such as style sheets) here,
66140# relative to this directory. They are copied after the builtin static files,
67141# so a file named "default.css" will overwrite the builtin "default.css".
68142html_static_path = ['_static' ]
143+ html_css_files = ["default.css" ]
144+
145+ # -- 国际化输出 ----------------------------------------------------------------
69146
70- # sphinx-intl
71147locale_dirs = ['locales/' ] # path is example but recommended.
72- gettext_compact = False # optional.
148+ gettext_compact = False # optional.
149+
150+ # -- 主题设置 -------------------------------------------------------------------
151+
152+ # 定制主侧栏
153+ html_sidebars = {
154+ "*" : [
155+ # 显示标志和网站标题。
156+ "sidebar-logo.html" ,
157+ #一个基于 bootstrap 的搜索栏(来自 PyData Sphinx Theme)
158+ "search-field.html" ,
159+ # 一个用于你的书基于 bootstrap 的导航菜单。
160+ "sbt-sidebar-nav.html" ,
161+ # 一个 可配置的 HTML 片段,用于添加到侧边栏(默认情况下,它被放置在底部)。
162+ "sbt-sidebar-footer.html" ,
163+ ],
164+ "posts/**" : [
165+ "postcard.html" ,
166+ "recentposts.html" ,
167+ "tagcloud.html" ,
168+ "categories.html" ,
169+ "archives.html" ,
170+ ],
171+ }
172+
173+ extra_navbar = """<div>
174+ 版权所有 © 2021 <a href="https://xinetzone.github.io/">xinetzone</a></div>
175+ <div>由 <a href="https://ebp.jupyterbook.org/">EBP</a> 提供技术支持</div>
176+ <div>语言切换<a href="/">中</a>/<a href="/en">英</a></div>
177+ """
178+
179+ html_theme_options = {
180+ # -- 如果你的文档只有一个页面,而且你不需要左边的导航栏,那么 ---------------
181+ # 你可以在 单页模式 下运行,
182+ # "single_page": False, # 默认 `False`
183+ # 默认情况下,编辑按钮将指向版本库的根。
184+ # 如果你的文档被托管在一个子文件夹中,请使用以下配置:
185+ "path_to_docs" : "docs/" , # 文档的路径,默认 `docs/``
186+ "repository_url" : "https://github.com/xinetzone/sphinx-demo" ,
187+ "repository_branch" : "main" , # 文档库的分支,默认 `master`
188+ # -- 在导航栏添加一个按钮,链接到版本库的议题 ------------------------------
189+ # (与 `repository_url` 和 `repository_branch` 一起使用)
190+ "use_issues_button" : True , # 默认 `False`
191+ # -- 在导航栏添加一个按钮,以下载页面的源文件。
192+ "use_download_button" : True , # 默认 `True`
193+ # 你可以在每个页面添加一个按钮,允许用户直接编辑页面文本,
194+ # 并提交拉动请求以更新文档。
195+ "use_edit_page_button" : True ,
196+ # 在导航栏添加一个按钮来切换全屏的模式。
197+ "use_fullscreen_button" : True , # 默认 `True`
198+ # -- 在导航栏中添加一个链接到文档库的按钮。----------------------------------
199+ "use_repository_button" : True , # 默认 `False`
200+ # -- 包含从 Jupyter 笔记本建立页面的 Binder 启动按钮。 ---------------------
201+ # "launch_buttons": '', # 默认 `False`
202+ "home_page_in_toc" : False , # 是否将主页放在导航栏(顶部)
203+ # -- 只显示标识,不显示 `html_title`,如果它存在的话。-----
204+ # "logo_only": True,
205+ # -- 在导航栏中显示子目录,向下到这里列出的深度。 ----
206+ # "show_navbar_depth": 2,
207+ # -- 在侧边栏页脚添加额外的 HTML -------------------
208+ # (如果 `sbt-sidebar-footer.html `在 `html_sidebars` 中被使用)。
209+ "extra_navbar" : extra_navbar ,
210+ # -- 在每个页面的页脚添加额外的 HTML。---
211+ # "extra_footer": '',
212+ # (仅限开发人员)触发一些功能,使开发主题更容易。
213+ # "theme_dev_mode": False
214+ # 重命名页内目录名称
215+ "toc_title" : "导航" ,
216+ "launch_buttons" : {
217+ # https://mybinder.org/v2/gh/xinetzone/sphinx-demo/main
218+ "binderhub_url" : "https://mybinder.org" ,
219+ # "jupyterhub_url": "https://datahub.berkeley.edu", # For testing
220+ "colab_url" : "https://colab.research.google.com/" ,
221+ # 你可以控制有人点击启动按钮时打开的界面。
222+ "notebook_interface" : "jupyterlab" ,
223+ "thebe" : True , # Thebe 实时代码单元格
224+ },
225+ }
226+ # -- 自定义网站的标志 --------------
227+ html_logo = 'logo.jpg'
228+ # The name of an image file (within the static path) to use as favicon of the
229+ # docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
230+ # pixels large.
231+ html_favicon = "page-logo.jfif"
232+
233+ # -- 自定义网站的标题 --------------
234+ # html_title = '动手学习 Python'
235+
236+ # ========== ABlog 配置 ============================================================
237+ blog_path = "posts"
238+ blog_post_pattern = "posts/*.md"
239+ blog_baseurl = "https://xinetzone.github.io/sphinx-demo"
240+ fontawesome_included = True
241+ post_auto_image = 1
242+ post_auto_excerpt = 2
243+ bibtex_bibfiles = ["references.bib" ]
244+ bibtex_reference_style = "author_year"
245+ # -- 博客作者、语言和位置 -------------------------------------------------
246+
247+ # 一个作者名字的字典,映射到作者的完整显示名称和链接。
248+ # 字典的键值应该在 ``post`` 指令中使用,以指代作者。默认是 ``{}``。
249+ blog_authors = {
250+ "lxw" : ("刘新伟" , None ),
251+ }
252+
253+ # 语言代码名称的字典,映射到这些语言的完整显示名称和链接。
254+ # 类似于 :confval:`blog_authors`,
255+ # 字典的键应该在 `post` 指令中使用,以指代位置。默认是 `{}`。
256+ blog_languages = {'zh' : ('Chinese' , None ), 'en' : ('English' , None )}
257+
258+ # 默认作者的名字
259+ blog_default_author = "lxw"
260+ # 默认语言的代码名称
261+ blog_default_language = 'zh'
262+ # 在 blog_locations 中定义的默认位置的名称。
263+ # blog_default_location = None
264+
265+ # -- 博客帖子相关 --------------------------------------------------------
266+
267+ # 帖子的日期格式。默认 ``'%b %d, %Y'``
268+ # ``datetime.date.strftime()`` 的参数
269+ post_date_format = '%c'
270+ post_date_format_short = '%b %d, %Y'
271+
272+ # todo_include_todos = True
273+
274+ # 如果你希望stderr和stdout中的每个输出都被合并成一个流,请使用以下配置。
275+ # 避免将 jupter 执行报错的信息输出到 cmd
276+ nb_merge_streams = True
277+ execution_allow_errors = True
278+ jupyter_execute_notebooks = "cache"
0 commit comments