Skip to content

Commit 324b422

Browse files
author
Jonas Berg
committed
Update HTML theme
1 parent db77cf6 commit 324b422

8 files changed

+72
-58
lines changed

.gitignore

+7
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,13 @@ doc/_copied
1010
.cproject
1111
.project
1212

13+
14+
# Python files
15+
docs/.mypy_cache/
16+
docs/_generated/
17+
docs/__pycache__/
18+
*venv*
19+
1320
# Object files
1421
*.o
1522
*.ko

doc/README.txt

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
To build the documentation, it is important to use the sphinx-build script
2+
installed in your virtual environment.
3+
Use CMAKE_IGNORE_PATH to prevent cmake from using a script installed elsewhere
4+
5+
Run these commands (adapt to your needs):
6+
7+
python3 -m venv myvenv
8+
source myvenv/bin/activate
9+
pip3 install -r doc/requirements.txt
10+
11+
cmake -B build -DCMAKE_IGNORE_PATH:PATH=$HOME/.local/bin
12+
cmake --build build/ --target sphinx-html

doc/conf.py

+33-28
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
# list see the documentation:
55
# https://www.sphinx-doc.org/en/master/usage/configuration.html
66

7+
8+
import os
79
import pathlib
810
import re
911
import sys
@@ -14,10 +16,6 @@
1416
# If extensions (or modules to document with autodoc) are in another directory,
1517
# add these directories to sys.path here. If the directory is relative to the
1618
# documentation root, use os.path.abspath to make it absolute, like shown here.
17-
#
18-
# import os
19-
# import sys
20-
# sys.path.insert(0, os.path.abspath('.'))
2119

2220
pathobj_docs_dir = pathlib.Path(__file__).parent.absolute()
2321
pathobj_rootdir = pathobj_docs_dir.parent.absolute()
@@ -42,16 +40,20 @@
4240
# ones.
4341
extensions = [
4442
"breathe",
45-
"myst_parser",
46-
"rst2pdf.pdfbuilder",
47-
"sphinx_rtd_theme",
43+
"recommonmark",
44+
"sphinx_copybutton",
45+
"sphinx_jinja",
46+
"sphinx.ext.autosectionlabel",
47+
"sphinx.ext.graphviz",
48+
"sphinxcontrib.kroki",
49+
"sphinxcontrib.programoutput",
4850
"sphinxcontrib.spelling",
4951
]
5052

5153
needs_sphinx = "1.8"
5254

5355
# Add any paths that contain templates here, relative to this directory.
54-
templates_path = ["_templates"]
56+
templates_path = ["../../_templates"]
5557

5658
# List of patterns, relative to source directory, that match files and
5759
# directories to ignore when looking for source files.
@@ -65,34 +67,37 @@
6567
'.md': 'markdown',
6668
}
6769

70+
breathe_projects = {project: "../build/doc/xml/"}
71+
breathe_default_project = project
6872

69-
# -- Options for HTML output -------------------------------------------------
7073

71-
# The theme to use for HTML and HTML Help pages. See the documentation for
72-
# a list of builtin themes.
73-
#
74-
html_theme = "sphinx_rtd_theme"
74+
# -- Options for HTML output -------------------------------------------------
7575

76-
# Add any paths that contain custom static files (such as style sheets) here,
77-
# relative to this directory. They are copied after the builtin static files,
78-
# so a file named "default.css" will overwrite the builtin "default.css".
79-
html_static_path = ["static"]
76+
html_context = {
77+
"default_mode": "light"
78+
}
8079

80+
html_theme = "sphinx_book_theme"
8181
html_theme_options = {
82-
"analytics_id": "G-378E9EVTG5",
83-
"display_version": True,
84-
"navigation_depth": 2,
82+
"show_nav_level": 3,
83+
"home_page_in_toc": True,
84+
"use_repository_button": True,
85+
"use_fullscreen_button": False,
86+
"navbar_end": ["navbar-icon-links"],
87+
"use_download_button": False,
88+
"repository_url": "https://github.com/rtlabs-com/p-nbet",
8589
}
8690

8791
html_last_updated_fmt = "%Y-%m-%d %H:%M"
88-
breathe_projects = {project: "../build/doc/xml/"}
89-
breathe_default_project = project
90-
91-
html_css_files = [
92-
"../../css/custom_rtd.css", # Requested by web developer
93-
"css/fix_table_width.css",
94-
"css/change_header_size.css",
95-
]
92+
html_static_path = ["static"]
93+
html_logo = "static/i/p-net.svg"
94+
html_show_sourcelink = False
95+
96+
if os.getenv("USE_EXTERNAL_CSS") is not None:
97+
html_css_files = [
98+
"https://rt-labs.com/content/themes/rtlabs2020/assets/css/style.css",
99+
"https://rt-labs.com/content/themes/rtlabs2020/assets/css/rt_custom_sphinx.css",
100+
]
96101

97102

98103
# -- Options for PDF output -------------------------------------------------

doc/doc_requirements.txt

-12
This file was deleted.

doc/requirements.txt

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Solve issue with missing bullet points
2+
# See https://stackoverflow.com/questions/67542699/readthedocs-sphinx-not-rendering-bullet-list-from-rst-file
3+
docutils==0.17.1
4+
5+
# Use versions that fit the docutils version
6+
breathe==4.34.0
7+
codespell==2.2.2
8+
graphviz==0.20.1
9+
myst-parser==0.18.1
10+
recommonmark==0.7.1
11+
rst2pdf==0.99
12+
rstcloth==0.5.3
13+
sphinx_book_theme==1.0.1
14+
sphinx-copybutton==0.5.1
15+
sphinx-jinja==2.0.2
16+
Sphinx==5.3.0
17+
sphinxcontrib-kroki==1.3.0
18+
sphinxcontrib-programoutput==0.17
19+
sphinxcontrib-spelling==8.0.0

doc/static/css/change_header_size.css

-3
This file was deleted.

doc/static/css/fix_table_width.css

-15
This file was deleted.

doc/static/i/p-net.svg

+1
Loading

0 commit comments

Comments
 (0)