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

Maintenance: Fix styling issues in the documentation builds. #177

Merged
merged 1 commit into from
Sep 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions _static/theme/theme_overrides.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
.wy-side-nav-search {
background-color: #19191a;
}

.wy-table-responsive table td {
white-space: normal !important;
}
Expand Down Expand Up @@ -74,3 +78,29 @@
gap: 10px;
align-items: center;
}

/*
* Sphinx RTD theme compatibility layer
*/

.wy-plain-list-disc li ul,
.rst-content .section ul li ul,
.rst-content .toctree-wrapper ul li ul,
article ul li ul {
margin-bottom: 12px;
}

.wy-menu-vertical header,
.wy-menu-vertical p.caption {
color: #55a5d9;
font-weight: 700;
font-size: 85%;
}

.wy-menu-vertical a {
color: #d9d9d9;
}

.wy-menu-vertical li.current a {
color: #404040;
}
42 changes: 15 additions & 27 deletions conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,40 +26,28 @@
html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
html_static_path = ['_static']

html_css_files = [
'https://media.readthedocs.org/css/sphinx_rtd_theme.css',
'https://media.readthedocs.org/css/readthedocs-doc-embed.css',
'theme/theme_overrides.css'
]

# Suppress "WARNING: unknown mimetype for ..." during EPUB builds.
# https://github.com/sphinx-doc/sphinx/issues/3214
suppress_warnings = ['epub.unknown_project_files']

on_rtd = os.environ.get('READTHEDOCS', None) == 'True'
if not on_rtd: # only import and set the theme if we're building docs locally
# Override default css to solve issues (e.g. width, overflows)
import sphinx_rtd_theme
html_theme = 'sphinx_rtd_theme'
html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
def setup(app):
app.add_css_file('theme/theme_overrides.css')

# We're running outside of readthedocs and expect the compiled version to
# be a pre release
branch = 'pre-release'
if not on_rtd:

# We're running outside of readthedocs and expect the compiled version to match the Git branch.
git_branch = os.environ.get('ZAMMAD_DOCS_GIT_BRANCH', None)

if git_branch == 'main':
branch = 'latest'
else:
branch = 'pre-release'

else:
# Override default css to solve issues (e.g. width, overflows)
# html context breaks sphinx tabs ~
# html_context = {
# 'css_files': [
# 'https://media.readthedocs.org/css/sphinx_rtd_theme.css',
# 'https://media.readthedocs.org/css/readthedocs-doc-embed.css',
# '_static/theme/theme_overrides.css',
# '_static/theme/tabs.css'
# ],
# }

html_css_files = [
'https://media.readthedocs.org/css/sphinx_rtd_theme.css',
'https://media.readthedocs.org/css/readthedocs-doc-embed.css',
'theme/theme_overrides.css'
]

# Get current version we're on for possible version warning
rtd_version = os.environ.get('READTHEDOCS_VERSION')
Expand Down