From 30b27c966f369ceb8889476869b5e20641cc97a3 Mon Sep 17 00:00:00 2001 From: Cody Glassman Date: Tue, 17 Jun 2025 08:44:15 -0700 Subject: [PATCH] docs - switch to awesome sphinx theme --- docs/requirements.txt | 5 ++--- docs/source/_static/theme-override.css | 17 ++++++++++++++++ docs/source/_static/theme.css | 11 ---------- docs/source/conf.py | 28 ++++++++++++++++---------- docs/source/index.rst | 2 +- 5 files changed, 37 insertions(+), 26 deletions(-) create mode 100644 docs/source/_static/theme-override.css delete mode 100644 docs/source/_static/theme.css diff --git a/docs/requirements.txt b/docs/requirements.txt index d57ac5d781..7847723e88 100644 --- a/docs/requirements.txt +++ b/docs/requirements.txt @@ -1,7 +1,6 @@ parse_cmake -sphinx==7.1.2 +sphinx==8.2.3 docutils==0.18.1 jinja2==3.1.6 sphinx-design==0.5.0 -furo==2024.8.6 -sphinx-copybutton==0.5.2 \ No newline at end of file +sphinxawesome-theme==6.0.0b2 \ No newline at end of file diff --git a/docs/source/_static/theme-override.css b/docs/source/_static/theme-override.css new file mode 100644 index 0000000000..edd184c431 --- /dev/null +++ b/docs/source/_static/theme-override.css @@ -0,0 +1,17 @@ +#content a.sd-badge:not(.toc-backref) { + text-decoration: none; +} + +@media (prefers-color-scheme: dark) { + .dark\:invert { + --tw-invert: none; + } +} + +.md-sidebar--primary { + width: 500px; /* default is 240px */ +} + +.md-content { + margin-left: 500px; /* match the new sidebar width */ +} diff --git a/docs/source/_static/theme.css b/docs/source/_static/theme.css deleted file mode 100644 index 2f0ef03b28..0000000000 --- a/docs/source/_static/theme.css +++ /dev/null @@ -1,11 +0,0 @@ -.content { - width: 60em; -} - -a.next-page, a.prev-page { - color: var(--color-link); -} - -a.next-page:hover, a.prev-page:hover { - text-decoration: underline; -} \ No newline at end of file diff --git a/docs/source/conf.py b/docs/source/conf.py index 5f5b772abe..32c7548606 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -16,6 +16,10 @@ import os import sys import subprocess +from dataclasses import asdict +from sphinxawesome_theme import ThemeOptions +from sphinxawesome_theme.postprocess import Icons + # If extensions (or modules to document with autodoc) are in another directory, # add these directories to sys.path here. If the directory is relative to the # documentation root, use os.path.abspath to make it absolute, like shown here. @@ -38,7 +42,6 @@ extensions = [ 'sphinx.ext.viewcode', 'sphinx.ext.autosectionlabel', 'sphinx_design', - 'sphinx_copybutton', ] #autosectionlabel_prefix_document = True @@ -147,20 +150,23 @@ primary_domain = 'c' # The theme to use for HTML and HTML Help pages. See the documentation for # a list of builtin themes. -html_theme = 'furo' +html_theme = 'sphinxawesome_theme' # Theme options are theme-specific and customize the look and feel of a theme # further. For a list of options available for each theme, see the # documentation. -html_theme_options = { - 'navigation_with_keys': True, - 'flyout_display': 'attached', - 'sidebar_hide_name': False, - 'top_of_page_buttons': [], -} +html_theme_options = asdict(ThemeOptions( + show_breadcrumbs=False, + main_nav_links= { + "Lua API": "reference/lua-scripting/index", + "Postprocessing": "reference/postprocessing/index", + } +)) + +html_permalinks_icon = Icons.permalinks_icon html_css_files = [ - "theme.css", + "theme-override.css", "luadoc.css", "figures.css" ] @@ -176,14 +182,14 @@ def setup(app): # The name for this set of Sphinx documents. If None, it defaults to # " v documentation". -html_title = 'OpenMW Docs' +html_title = 'OpenMW' # A shorter title for the navigation bar. Default is the same as html_title. # html_short_title = 'OpenMW Documentation' # The name of an image file (relative to this directory) to place at the top # of the sidebar. -# html_logo = 'https://gitlab.com/OpenMW/openmw-docs/raw/master/docs/source/_static/images/openmw.png' +html_logo = 'https://gitlab.com/OpenMW/openmw-docs/raw/master/docs/source/_static/images/openmw.png' # The name of an image file (within the static path) to use as favicon of the # docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 diff --git a/docs/source/index.rst b/docs/source/index.rst index de3773ddbd..532c041e82 100644 --- a/docs/source/index.rst +++ b/docs/source/index.rst @@ -3,7 +3,7 @@ Welcome to OpenMW's Documentation! .. toctree:: :caption: Table of Contents - :maxdepth: 3 + :maxdepth: 8 manuals/index reference/index