Skip to content

Commit 979476c

Browse files
authored
Merge pull request #823 from stan-dev/docs/mc-stan-theme
Update docs theming to match mc-stan.org
2 parents a443a9d + 7367e3e commit 979476c

File tree

7 files changed

+62
-73
lines changed

7 files changed

+62
-73
lines changed

docsrc/_static/css/custom.css

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
html[data-theme="light"] {
2+
--pst-color-background: #fefbf2;
3+
--pst-color-primary: #3e8ebc;
4+
--pst-color-secondary: #3e8ebc;
5+
--pst-color-accent: #aed1e4;
6+
7+
--pst-color-text-base: #343a40;
8+
--pst-color-heading: #222832;
9+
10+
header {
11+
--pst-color-on-background: #052744;
12+
--pst-color-text-muted: #f2e5bd;
13+
--pst-color-text-base: #93b0f1;
14+
}
15+
}
16+
17+
html[data-theme="dark"] {
18+
--pst-color-link: #aed1e4;
19+
--pst-color-primary: #3e8ebc;
20+
--pst-color-secondary: #3e8ebc;
21+
--pst-color-accent: #aed1e4;
22+
23+
--pst-color-text-base: #faf1e4;
24+
25+
header {
26+
--pst-color-on-background: #303030;
27+
--pst-color-text-muted: #bdbdbd;
28+
--pst-color-primary: #aed1e4;
29+
--pst-color-text-base: #aed1e4;
30+
}
31+
}

docsrc/_templates/layout.html

Lines changed: 0 additions & 13 deletions
This file was deleted.

docsrc/_templates/logo.html

Lines changed: 0 additions & 3 deletions
This file was deleted.

docsrc/_templates/title.html

Lines changed: 0 additions & 2 deletions
This file was deleted.

docsrc/conf.py

Lines changed: 28 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
# All configuration values have a default; values that are commented out
1313
# serve to show the default.
1414

15+
import datetime
1516
import os
1617
import subprocess
1718
import sys
@@ -136,7 +137,7 @@ def emit(self, record):
136137

137138
# General information about the project.
138139
project = 'CmdStanPy'
139-
copyright = '2023, Stan Development Team'
140+
copyright = f'{datetime.date.today().year}, Stan Development Team'
140141

141142
# The version info for the project you're documenting, acts as replacement for
142143
# |version| and |release|, also used in various other places throughout the
@@ -149,69 +150,26 @@ def emit(self, record):
149150
# The full version, including alpha/beta/rc tags.
150151
release = __version__
151152

152-
# The language for content autogenerated by Sphinx. Refer to documentation
153-
# for a list of supported languages.
154-
# language = None
155-
156-
# There are two options for replacing |today|: either, you set today to some
157-
# non-false value, then it is used:
158-
# today = ''
159-
# Else, today_fmt is used as the format for a strftime call.
160-
# today_fmt = '%B %d, %Y'
161-
162153
# List of patterns, relative to source directory, that match files and
163154
# directories to ignore when looking for source files.
164155
exclude_patterns = ['_build', '_templates']
165156

166-
# The reST default role (used for this markup: `text`) to use for all
167-
# documents.
168-
# default_role = None
169-
170-
# If true, '()' will be appended to :func: etc. cross-reference text.
171-
# add_function_parentheses = True
172-
173-
# If true, the current module name will be prepended to all description
174-
# unit titles (such as .. function::).
175-
# add_module_names = True
176-
177-
# If true, sectionauthor and moduleauthor directives will be shown in the
178-
# output. They are ignored by default.
179-
# show_authors = False
180-
181-
# The name of the Pygments (syntax highlighting) style to use.
182-
pygments_style = 'sphinx'
183-
184-
# Custom style
185-
html_style = 'css/project-template.css'
186-
187-
# A list of ignored prefixes for module index sorting.
188-
# modindex_common_prefix = []
189-
190-
# If true, keep warnings as "system message" paragraphs in the built documents.
191-
# keep_warnings = False
192-
193157

194158
# -- Options for HTML output ----------------------------------------------
195159

196160
# The theme to use for HTML and HTML Help pages. See the documentation for
197161
# a list of builtin themes.
198162
html_theme = 'pydata_sphinx_theme' # https://pydata-sphinx-theme.readthedocs.io/en/latest/index.html
199-
# theme is customized via _templates/
163+
html_static_path = ["_static"]
164+
html_css_files = [
165+
"css/custom.css",
166+
]
167+
html_favicon = "_static/images/logo_icon.png"
200168

201-
# Theme options are theme-specific and customize the look and feel of a theme
202-
# further. For a list of options available for each theme, see the
203-
# documentation.
204-
# html_theme_options = {}
169+
html_show_sphinx = False
205170

206171
html_theme_options = {
207-
"navbar_start": ["title"],
208-
"page_sidebar_items": ["page-toc", "edit-this-page"],
209172
"icon_links": [
210-
{
211-
"name": "Twitter",
212-
"url": "https://twitter.com/mcmc_stan",
213-
"icon": "fab fa-twitter",
214-
},
215173
{
216174
"name": "GitHub",
217175
"url": "https://github.com/stan-dev/cmdstanpy",
@@ -223,11 +181,29 @@ def emit(self, record):
223181
"icon": "fas fa-users",
224182
},
225183
],
184+
"logo": {
185+
"text": "CmdStanPy v" + release if release else "CmdStanPy",
186+
"alt_text": "CmdStanPy - Home",
187+
"image_light": "_static/images/logo_tm.png",
188+
"image_dark": "_static/images/logo_tm.png",
189+
},
190+
"navbar_align": "left",
191+
"navbar_persistent": [],
192+
"navbar_end": ["navbar-icon-links", "theme-switcher", "search-button"],
193+
"footer_start": ["copyright"],
194+
"footer_end": [],
195+
"primary_sidebar_end": [],
196+
"secondary_sidebar_items": {
197+
"**": ["page-toc", "sourcelink", "edit-this-page"],
198+
"index": [],
199+
},
226200
"use_edit_page_button": True,
201+
"default_mode": "light",
227202
"show_toc_level": 2,
203+
"pygments_light_style": "tango",
204+
"pygments_dark_style": "nord",
228205
}
229206

230-
html_sidebars = {"index": ["search-field", 'logo']}
231207

232208
html_context = {
233209
"github_user": "stan-dev",
@@ -405,7 +381,7 @@ def emit(self, record):
405381
"CmdStanVB": "~cmdstanpy.CmdStanVB",
406382
"CmdStanGQ": "~cmdstanpy.CmdStanGQ",
407383
"CmdStanLaplace": "~cmdstanpy.CmdStanLaplace",
408-
"CmdStanPathfinder": "~cmdstanpy.CmdStanPathfinder"
384+
"CmdStanPathfinder": "~cmdstanpy.CmdStanPathfinder",
409385
}
410386

411387
nbsphinx_allow_errors = False

docsrc/index.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ Python classes which provide methods to do analysis and manage the resulting
2222
set of model, data, and posterior estimates.
2323

2424
.. toctree::
25-
:maxdepth: 4
25+
:maxdepth: 3
2626

2727
installation
2828
users-guide

pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,8 @@ test = [
5252
"polars>=1.8.2"
5353
]
5454
docs = [
55-
"sphinx>5,<6",
56-
"pydata-sphinx-theme<0.9",
55+
"sphinx<9",
56+
"pydata-sphinx-theme<0.17",
5757
"nbsphinx",
5858
"ipython",
5959
"ipykernel<7",

0 commit comments

Comments
 (0)