Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RTD doc build updates, fixes #7

Merged
merged 9 commits into from
Jan 23, 2024
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ instance/
# Sphinx documentation
docs/_build/
docs/modules.rst
docs/hpvsim.*.rst
docs/hpvsim*.rst

# PyBuilder
target/
Expand Down
45 changes: 42 additions & 3 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,26 @@
'sphinx.ext.todo',
'sphinx.ext.viewcode', # Add a link to the Python source code for classes, functions etc.
'nbsphinx',
'IPython.sphinxext.ipython_console_highlighting' # Temporary fix for https://github.com/spatialaudio/nbsphinx/issues/687
'IPython.sphinxext.ipython_console_highlighting', # Temporary fix for https://github.com/spatialaudio/nbsphinx/issues/687
'sphinx_search.extension', # search across multiple docsets in domain
'myst_parser', # source files written in MD or RST
]

myst_enable_extensions = [
"amsmath",
"attrs_inline",
"colon_fence",
"deflist",
"dollarmath",
"fieldlist",
"html_admonition",
"html_image",
"linkify",
"replacements",
"smartquotes",
"strikethrough",
"substitution",
"tasklist",
]

autodoc_default_options = {
Expand All @@ -81,7 +100,7 @@

# The suffix(es) of source filenames.
# You can specify multiple suffix as a list of string:
source_suffix = '.rst'
source_suffix = ['.rst', '.md']
master_doc = 'index'

# General information about the project.
Expand All @@ -101,7 +120,7 @@
# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This patterns also effect to html_static_path and html_extra_path
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store', 'README.md']

# suppress warnings for multiple possible Python references in the namespace
# suppress_warnings = ['ref.python']
Expand Down Expand Up @@ -131,8 +150,13 @@
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".

html_static_path = ['_static']

html_css_files = ['theme_overrides.css']

html_js_files = ['show_block_by_os.js']

html_context = {
'rtd_url': 'https://docs.idmod.org/projects/hpvsim/en/latest',
'theme_vcs_pageview_mode': 'edit'
Expand All @@ -159,6 +183,21 @@
# base URL from which the finished HTML is served.
html_use_opensearch = 'docs.idmod.org/projects/hpvsim/en/latest'

# -- RTD Sphinx search for searching across the entire domain, default child -------------

if os.environ.get('READTHEDOCS') == 'True':

search_project_parent = "institute-for-disease-modeling-idm"
search_project = os.environ["READTHEDOCS_PROJECT"]
search_version = os.environ["READTHEDOCS_VERSION"]

rtd_sphinx_search_default_filter = f"subprojects:{search_project}/{search_version}"

rtd_sphinx_search_filters = {
"Search this project": f"project:{search_project}/{search_version}",
"Search all IDM docs": f"subprojects:{search_project_parent}/{search_version}",
}

# Output file base name for HTML help builder.
htmlhelp_basename = 'HPVsim'

Expand Down
4 changes: 4 additions & 0 deletions docs/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,7 @@ pandoc
pypandoc
optuna
seaborn
myst-parser
readthedocs-sphinx-search
jupyterlab
linkify-it-py
Loading