Skip to content

Commit 0fa30cd

Browse files
authored
Fixed Issue With Documentation Environment (#165)
* Added example code to config file * Added html context * Mirrored a setup on GitHub See: readthedocs/readthedocs.org#4912 (comment) * Fixed typo
1 parent 34a1d75 commit 0fa30cd

File tree

2 files changed

+21
-5
lines changed

2 files changed

+21
-5
lines changed

.readthedocs.yaml

+2-3
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,9 @@ build:
66
python: "3.11"
77
jobs:
88
post_create_environment:
9-
- pip install poetry
10-
- poetry config virtualenvs.create false
9+
- python -m pip install poetry
1110
post_install:
12-
- poetry install --with docs
11+
- VIRTUAL_ENV=$READTHEDOCS_VIRTUALENV_PATH poetry install --with docs
1312

1413
sphinx:
1514
configuration: docs/conf.py

docs/conf.py

+19-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
# If extensions (or modules to document with autodoc) are in another directory,
1010
# add these directories to sys.path here. If the directory is relative to the
1111
# documentation root, use os.path.abspath to make it absolute, like shown here.
12-
#
1312
import os
1413
import sys
1514

@@ -48,9 +47,18 @@
4847

4948
# The theme to use for HTML and HTML Help pages. See the documentation for
5049
# a list of builtin themes.
51-
#
5250
html_theme = "sphinx_rtd_theme"
5351

52+
# Adds "edit source" links
53+
# Source: https://docs.readthedocs.io/en/stable/guides/edit-source-links-sphinx.html
54+
html_context = {
55+
"display_github": True, # Integrate GitHub
56+
"github_user": "TheRenegadeCoder", # Username
57+
"github_repo": "SnakeMD", # Repo name
58+
"github_version": "main", # Version
59+
"conf_py_path": "/docs/", # Path in the checkout to the docs root
60+
}
61+
5462
# Add any paths that contain custom static files (such as style sheets) here,
5563
# relative to this directory. They are copied after the builtin static files,
5664
# so a file named "default.css" will overwrite the builtin "default.css".
@@ -64,3 +72,12 @@
6472
intersphinx_mapping = {"python": ("https://docs.python.org/3", None)}
6573

6674
html_theme_options = {"display_version": True}
75+
76+
# -- ReadTheDocs Configuration
77+
78+
# Set canonical URL from the Read the Docs Domain
79+
html_baseurl = os.environ.get("READTHEDOCS_CANONICAL_URL", "")
80+
81+
# Tell Jinja2 templates the build is running on Read the Docs
82+
if os.environ.get("READTHEDOCS", "") == "True":
83+
html_context["READTHEDOCS"] = True

0 commit comments

Comments
 (0)