Skip to content

Switch documentation theme to immaterial (w/ support for dark mode) #25735

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

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
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
10 changes: 8 additions & 2 deletions docs/build
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,15 @@ cd "${BASH_SOURCE%/*}"

test -t 1 && OPTS='-it' || OPTS=''

SPHINX_IMAGE=${SPHINX_IMAGE:-ghcr.io/trinodb/build/sphinx:114}
SPHINX_IMAGE=${SPHINX_IMAGE:-ghcr.io/trinodb/build/sphinx:115}

docker run --security-opt label:disable --rm $OPTS -e TRINO_VERSION -u $(id -u):$(id -g) -v "$PWD":/docs $SPHINX_IMAGE \
# Ensure target is empty so that sitemap is always fully generated
rm -Rf target

# Ensure a writable cache directory
mkdir -p target/.cache

docker run --security-opt label:disable --rm $OPTS -e TRINO_VERSION -e XDG_CACHE_HOME=/docs/target/.cache -u $(id -u):$(id -g) -v "$PWD":/docs $SPHINX_IMAGE \
sphinx-build -q -j auto -b html -W --keep-going -d target/doctrees src/main/sphinx target/html

# Sort sitemap for reproducible builds
Expand Down
2 changes: 0 additions & 2 deletions docs/src/main/sphinx/admin.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,6 @@ with Trino for further analysis or reporting.
The following event listeners are available:

```{toctree}
:titlesonly: true

admin/event-listeners-http
admin/event-listeners-kafka
admin/event-listeners-mysql
Expand Down
2 changes: 0 additions & 2 deletions docs/src/main/sphinx/admin/properties.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ catalog configuration properties. For more information on catalog configuration
properties, refer to the {doc}`connector documentation </connector/>`.

```{toctree}
:titlesonly: true

General <properties-general>
Client protocol <properties-client-protocol>
HTTP server <properties-http-server>
Expand Down
73 changes: 61 additions & 12 deletions docs/src/main/sphinx/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,14 +81,15 @@ def setup(app):
'issue',
'sphinx_copybutton',
'redirects',
'sphinxcontrib.jquery'
'sphinxcontrib.jquery',
'sphinx_immaterial'
]

redirects_file = 'redirects.txt'

templates_path = ['templates']

source_suffix = '.rst'
source_suffix = '.md'

master_doc = 'index'

Expand Down Expand Up @@ -122,7 +123,7 @@ def setup(app):

# -- Options for HTML output ---------------------------------------------------

html_theme = 'sphinx_material'
html_theme = 'sphinx_immaterial'

html_static_path = ['static']

Expand All @@ -141,17 +142,57 @@ def setup(app):
}

html_theme_options = {
'base_url': html_baseurl,
'globaltoc_depth': -1,
'theme_color': '2196f3',
'color_primary': '', # set in CSS
'color_accent': '', # set in CSS
'site_url': html_baseurl,
'toc_title': 'Contents',
'features': [
'content.action.edit',
'content.action.view',
'content.code.copy',
'content.tabs.link',
'content.tooltips'
'navigation.expand',
'navigation.footer',
'navigation.sections',
'navigation.top',
'navigation.tracking',
'search.share',
'search.suggest',
'toc.follow',
],
'icon': {
'repo': 'fontawesome/brands/github-alt',
'edit': 'material/file-edit-outline',
'view': 'material/file-eye-outline'
},
'palette': [
{
'media': '(prefers-color-scheme)',
'scheme': 'default',
'toggle': {
'icon': 'material/brightness-auto',
'name': 'Switch to light mode',
}
},
{
'media': '(prefers-color-scheme: light)',
'scheme': 'default',
'toggle': {
'icon': 'material/weather-sunny',
'name': 'Switch to dark mode',
}
},
{
'media': '(prefers-color-scheme: dark)',
'scheme': 'slate',
'toggle': {
'icon': 'material/weather-night',
'name': 'Switch to system preference',
}
},
],
'repo_url': 'https://github.com/trinodb/trino',
'repo_name': 'Trino',
'version_json': '../versions.json',
'nav_previous_text': 'Previous',
'nav_next_text': 'Next',
'search_placeholder_text': 'Search'
'edit_uri': 'blob/master/docs/src/main/sphinx'
}

html_css_files = [
Expand All @@ -161,3 +202,11 @@ def setup(app):
suppress_warnings = [
'config.cache'
]

object_description_options = [
("c:.*", dict(toc_icon_class=None, toc_icon_text=None)),
("cpp:.*", dict(toc_icon_class=None, toc_icon_text=None)),
("py:.*", dict(toc_icon_class=None, toc_icon_text=None)),
("json:.*", dict(toc_icon_class=None, toc_icon_text=None)),
("std:.*", dict(toc_icon_class=None, toc_icon_text=None))
]
4 changes: 0 additions & 4 deletions docs/src/main/sphinx/index.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
# Trino documentation

```{toctree}
:titlesonly: true

overview
installation
client
Expand All @@ -22,7 +20,5 @@ appendix

```{toctree}
:maxdepth: 1
:titlesonly: true

release
```
23 changes: 6 additions & 17 deletions docs/src/main/sphinx/static/trino.css
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,6 @@ html {
scroll-behavior: smooth;
}

div.highlight {
background-color: #f5f5f5;
}

.md-header, .md-hero, .md-tabs {
background-color: #0B1367;
}
Expand Down Expand Up @@ -53,16 +49,13 @@ div.highlight {
height: 48px;
}

.md-typeset h1 {
color: rgba(0, 0, 0, .80);
}

.sig-name, .sig-paren {
font-weight: bold;
}

.md-typeset code {
padding: 0 0.3em;
border-radius: 0.3rem;
}

pre.literal-block {
Expand All @@ -81,15 +74,6 @@ pre.literal-block {
font-size: unset;
}

@media only screen and (min-width: 88.25em) {
.md-grid {
max-width: 75rem;
}

.md-sidebar--secondary {
margin-left: 75rem;
}
}

.copybtn:hover {
cursor: copy;
Expand All @@ -105,3 +89,8 @@ button.copybtn {
position: relative;
top: -5.5rem;
}

.toctree-wrapper ul {
list-style-type: none;
padding-left: 0;
}
1 change: 0 additions & 1 deletion docs/src/main/sphinx/udf.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ value, similar to [built-in functions](/functions).
More details are available in the following sections:

```{toctree}
:titlesonly: true
:maxdepth: 1

udf/introduction
Expand Down
1 change: 0 additions & 1 deletion docs/src/main/sphinx/udf/python.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ The same UDF can also be declared as [](udf-catalog).
Refer to the [](/udf/python/examples) for more complex use cases and examples.

```{toctree}
:titlesonly: true
:hidden:

/udf/python/examples
Expand Down
3 changes: 1 addition & 2 deletions docs/src/main/sphinx/udf/sql.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ operators](/functions) and other UDFs:
* [](/udf/sql/while)

```{toctree}
:titlesonly: true
:hidden:

sql/examples
Expand Down Expand Up @@ -104,4 +103,4 @@ The following limitations apply to SQL UDFs.
Specifically this means that UDFs can not use `SELECT` queries to retrieve
data or any other queries to process data within the UDF. Instead queries can
use UDFs to process data. UDFs only work on data provided as input values and
only provide output data from the `RETURN` statement.
only provide output data from the `RETURN` statement.