Skip to content

Commit b4b1560

Browse files
committed
conf.py
1 parent 5529a12 commit b4b1560

1 file changed

Lines changed: 27 additions & 3 deletions

File tree

docs/source/conf.py

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,15 @@
1818
from importlib.metadata import version
1919
from pathlib import Path
2020

21+
# Attempt to import the version dynamically from GitHub tag.
22+
try:
23+
fullversion = version("diffpy.labpdfproc")
24+
except Exception:
25+
fullversion = (
26+
"No version found. "
27+
"The correct version will appear in the released version."
28+
)
29+
2130
# If extensions (or modules to document with autodoc) are in another directory,
2231
# add these directories to sys.path here. If the directory is relative to the
2332
# documentation root, use Path().resolve() to make it absolute, like shown here
@@ -26,7 +35,9 @@
2635
sys.path.insert(0, str(Path("../../src").resolve()))
2736

2837
# abbreviations
29-
ab_authors = "Billinge Group members and community contributors"
38+
ab_authors = (
39+
"Yucong Chen, Till Schertenleib, Caden Myers, Billinge Group members"
40+
)
3041

3142
# -- General configuration ------------------------------------------------
3243

@@ -43,7 +54,8 @@
4354
"sphinx.ext.viewcode",
4455
"sphinx.ext.intersphinx",
4556
"sphinx_rtd_theme",
46-
"m2r",
57+
"sphinx_copybutton",
58+
"m2r2",
4759
]
4860

4961
# Add any paths that contain templates here, relative to this directory.
@@ -68,7 +80,6 @@
6880
# |version| and |release|, also used in various other places throughout the
6981
# built documents.
7082

71-
fullversion = version(project)
7283
# The short X.Y version.
7384
version = "".join(fullversion.split(".post")[:1])
7485
# The full version, including alpha/beta/rc tags.
@@ -88,6 +99,11 @@
8899
# substitute YEAR in the copyright string
89100
copyright = copyright.replace("%Y", year)
90101

102+
# For sphinx_copybutton extension.
103+
# Do not copy "$" for shell commands in code-blocks.
104+
copybutton_prompt_text = r"^\$ "
105+
copybutton_prompt_is_regexp = True
106+
91107
# List of patterns, relative to source directory, that match files and
92108
# directories to ignore when looking for source files.
93109
exclude_patterns = ["build"]
@@ -123,6 +139,14 @@
123139
#
124140
html_theme = "sphinx_rtd_theme"
125141

142+
html_context = {
143+
"display_github": True,
144+
"github_user": "diffpy",
145+
"github_repo": "diffpy.labpdfproc",
146+
"github_version": "main",
147+
"conf_py_path": "/docs/source/",
148+
}
149+
126150
# Theme options are theme-specific and customize the look and feel of a theme
127151
# further. For a list of options available for each theme, see the
128152
# documentation.

0 commit comments

Comments
 (0)