Skip to content

Commit

Permalink
换用主题 sphinx_book_theme
Browse files Browse the repository at this point in the history
  • Loading branch information
FeignClaims committed Jan 29, 2024
1 parent 64a67b3 commit 27939d2
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 3 deletions.
2 changes: 1 addition & 1 deletion docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
sphinx_rtd_theme==2.0.0
sphinx_book_theme==1.1.0
sphinx_togglebutton==0.3.2
sphinx-last-updated-by-git==0.3.6
34 changes: 34 additions & 0 deletions docs/source/_static/custom.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
span.menuselection {
background-color: #dce7fc;
border: 1px solid #276be9;
border-radius: 4px;
color: #276be9;
font-size: 80%;
font-weight: 700;
margin: auto 2px;
padding: 2.4px 6px;
position: relative;
}
span.menuselection:before {
content: "";
height: 100%;
left: 0;
pointer-events: none;
position: absolute;
top: 0;
width: 100%;
z-index: -1;
}

html {
--pst-font-size-h1: 1.75rem;
--pst-font-size-h2: 1.5rem;
--pst-font-size-h3: 1.3rem;
--pst-font-size-h4: 1.2rem;
--pst-font-size-h5: 1.1rem;
--pst-font-size-h6: 1.05rem;
}

.toctree-wrapper li[class^="toctree-l"] > a {
font-size: 1em;
}
19 changes: 17 additions & 2 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration

extensions = ['sphinx_togglebutton', 'sphinx_last_updated_by_git', 'sphinx.ext.todo',
'sphinx.ext.graphviz', 'sphinx.ext.extlinks', 'sphinx_rtd_theme']
'sphinx.ext.graphviz', 'sphinx.ext.extlinks']

togglebutton_hint = ""
togglebutton_hint_hide = ""
Expand All @@ -37,7 +37,20 @@
# -- Options for HTML output -------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output

html_theme = 'sphinx_rtd_theme'
html_theme = 'sphinx_book_theme'
html_theme_options = {
'repository_url': 'https://github.com/FeignClaims/question_board',
'path_to_docs': 'docs/source/',
'use_source_button': True,
'use_edit_page_button': True,
'use_issues_button': True,
'show_prev_next': False,
'show_nav_level': 0,
'show_toc_level': 2,
"secondary_sidebar_items": {
"**": ["page-toc", "sourcelink"],
}
}
html_static_path = ['_static']
html_favicon = '_static/favicon.png'
html_search_language = 'zh'
Expand All @@ -46,6 +59,8 @@


def setup(app):
app.add_css_file("custom.css")

FORCE_RELOAD_JS = """
(function () {
if (window.localStorage) {
Expand Down

0 comments on commit 27939d2

Please sign in to comment.