Skip to content

Commit

Permalink
更新文档
Browse files Browse the repository at this point in the history
  • Loading branch information
liuxinwei committed Dec 12, 2024
1 parent e61b9b1 commit 106c7d9
Show file tree
Hide file tree
Showing 2 changed files with 77 additions and 58 deletions.
80 changes: 22 additions & 58 deletions doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
from pathlib import Path

ROOT = Path('__file__').resolve().parents[1]
sys.path.extend([str(ROOT/'src'), str(ROOT/'doc/_ext')])
sys.path.extend([str(ROOT/'src'), str(ROOT/"doc"), str(ROOT/'doc/_ext')])
from utils.icon import icon_links
import torch_book

if sys.platform == 'win32':
Expand Down Expand Up @@ -186,6 +187,19 @@
autoapi_root = "api"
autoapi_member_order = "groupwise"

# ``pydata-sphinx-theme`` 配置
# Define the json_url for our version switcher.
json_url = 'https://xinetzone.github.io/d2py/_static/switcher.json'
# -- Sitemap -----------------------------------------------------------------
# ReadTheDocs has its own way of generating sitemaps, etc.
if not os.environ.get("READTHEDOCS"):
extensions += ["sphinx_sitemap"]
html_baseurl = os.environ.get("SITEMAP_URL_BASE", "http://127.0.0.1:8000/")
sitemap_locales = [None]
sitemap_url_scheme = "{link}"
# Define the version we use for matching in the version switcher.
version_match = os.environ.get("READTHEDOCS_VERSION")

html_theme_options = {
# -- 如果你的文档只有一个页面,而且你不需要左边的导航栏,那么 ---------------
# 你可以在 单页模式 下运行,
Expand Down Expand Up @@ -233,63 +247,13 @@
"deepnote_url": "https://deepnote.com",
},
# 图标可以参考 https://fontawesome.com/icons
"icon_links": [
# {
# "name": "GitHub",
# "url": "https://github.com/xinetzone/torch_book",
# "icon": "fa-brands fa-square-github",
# "type": "fontawesome",
# },
{
"name": "知乎",
"url": "https://www.zhihu.com/people/xinetzone",
"icon": "fa-brands fa-zhihu",
"type": "fontawesome",
},
{
"name": "简书",
"url": "https://www.jianshu.com/u/4302480a3e8e",
"icon": "fa-solid fa-book",
"type": "fontawesome",
},
{
"name": "B站",
"url": "https://space.bilibili.com/252192181",
"icon": "fa-brands fa-bilibili",
"type": "fontawesome",
},
{
"name": "博客园",
"url": "https://www.cnblogs.com/q735613050/",
"icon": "https://xinetzone.github.io/xinetzone/media/xinetzone.jpg",
"type": "url",
},
{
"name": "领英",
"url": "https://www.linkedin.com/in/xinet",
"icon": "fa-brands fa-linkedin",
"type": "fontawesome",
}
# {
# "name": "GitLab",
# "url": "https://gitlab.com/<your-org>/<your-repo>",
# "icon": "fa-brands fa-square-gitlab",
# "type": "fontawesome",
# },
# {
# "name": "Twitter",
# "url": "https://twitter.com/<your-handle>",
# "icon": "fa-brands fa-square-twitter",
# # The default for `type` is `fontawesome` so it is not actually required in any of the above examples as it is shown here
# },
# {
# "name": "Mastodon",
# "url": "https://<your-host>@<your-handle>",
# "icon": "fa-brands fa-mastodon",
# },
],
# "footer_start": ["copyright", "sphinx-version"],
# "footer_end": ["last-updated", ],
"icon_links": icon_links,
"switcher": {
"json_url": json_url,
"version_match": version_match,
},
"footer_start": ["version-switcher", "copyright"],
"footer_end": ["sphinx-version", "last-updated"],
}
# -- 自定义网站的标志 --------------
html_logo = 'logo.jpg'
Expand Down
55 changes: 55 additions & 0 deletions doc/utils/icon.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
icon_links = [
# {
# "name": "GitHub",
# "url": "https://github.com/xinetzone/tvm-book",
# "icon": "fa-brands fa-square-github",
# "type": "fontawesome",
# },
{
"name": "知乎",
"url": "https://www.zhihu.com/people/xinetzone",
"icon": "fa-brands fa-zhihu",
"type": "fontawesome",
},
{
"name": "简书",
"url": "https://www.jianshu.com/u/4302480a3e8e",
"icon": "fa-solid fa-book",
"type": "fontawesome",
},
{
"name": "B站",
"url": "https://space.bilibili.com/252192181",
"icon": "fa-brands fa-bilibili",
"type": "fontawesome",
},
{
"name": "博客园",
"url": "https://www.cnblogs.com/q735613050/",
"icon": "https://xinetzone.github.io/xinetzone/media/xinetzone.jpg",
"type": "url",
},
{
"name": "领英",
"url": "https://www.linkedin.com/in/xinet",
"icon": "fa-brands fa-linkedin",
"type": "fontawesome",
},
# {
# "name": "GitLab",
# "url": "https://gitlab.com/<your-org>/<your-repo>",
# "icon": "fa-brands fa-square-gitlab",
# "type": "fontawesome",
# },
# {
# "name": "Twitter",
# "url": "https://twitter.com/<your-handle>",
# "icon": "fa-brands fa-square-twitter",
# # The default for `type` is `fontawesome` so it is not actually required in any of the above examples as it is shown here
# },
# {
# "name": "Mastodon",
# "url": "https://<your-host>@<your-handle>",
# "icon": "fa-brands fa-mastodon",
# },
]

0 comments on commit 106c7d9

Please sign in to comment.