Skip to content

Commit

Permalink
Maintenance: Fix styling issues in the documentation builds.
Browse files Browse the repository at this point in the history
  • Loading branch information
dvuckovic committed Sep 19, 2023
1 parent 6942629 commit 6c7ce7e
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 23 deletions.
28 changes: 27 additions & 1 deletion _static/theme/theme_overrides.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
max-width: 1050px
}
.wy-side-nav-search {
background-color: #b95f29;
background-color: #19191a;
}

/* Provide a button and shortened pres to reduce page heights */
Expand Down Expand Up @@ -66,3 +66,29 @@
.rst-content table.docutils td {
vertical-align: top;
}

/*
* 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;
}
40 changes: 18 additions & 22 deletions conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,15 @@

html_theme = "sphinx_rtd_theme"
html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
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'
]

html_js_files = [
'theme/zammad_overrides.js',
]

# Suppress "WARNING: unknown mimetype for ..." during EPUB builds.
# https://github.com/sphinx-doc/sphinx/issues/3214
Expand All @@ -31,30 +40,17 @@
# thanks to https://blog.deimos.fr/2014/10/02/sphinxdoc-and-readthedocs-theme-tricks-2/

on_rtd = os.environ.get('READTHEDOCS', None) == 'True'
if not on_rtd: # only import and set the theme if we're building docs locally
import sphinx_rtd_theme
html_theme = 'sphinx_rtd_theme'
html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
# Override default css to get a larger width for local build
def setup(app):
app.add_js_file('theme/zammad_overrides.js')
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 get a larger width for ReadTheDoc build
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'
]

html_js_files = [
'theme/zammad_overrides.js',
]

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

0 comments on commit 6c7ce7e

Please sign in to comment.