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

doc: build docs on readthedocs #254

Draft
wants to merge 9 commits into
base: main
Choose a base branch
from
Draft
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
20 changes: 20 additions & 0 deletions docs/.readthedocs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
version: 2

build:
os: ubuntu-24.04
tools:
python: "3"

jobs:
post_create_environment:
# Install poetry
- asdf plugin add poetry
- asdf install poetry latest
- asdf global poetry latest
- poetry config virtualenvs.create false
post_install:
# Install deps and build using poetry
- . "$READTHEDOCS_VIRTUALENV_PATH/bin/activate" && cd docs && poetry install

mkdocs:
configuration: docs/mkdocs.yml
24 changes: 24 additions & 0 deletions docs/docs/scripts/readthedocs.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// Use CustomEvent to generate the version selector
document.addEventListener(
"readthedocs-addons-data-ready",
function (event) {
const config = event.detail.data();
const versioning = `
<div class="md-version">
<button class="md-version__current" aria-label="Select version">
${config.versions.current.slug}
</button>

<ul class="md-version__list">
${ config.versions.active.map(
(version) => `
<li class="md-version__item">
<a href="${ version.urls.documentation }" class="md-version__link">
${ version.slug }
</a>
</li>`).join("\n")}
</ul>
</div>`;

document.querySelector(".md-header__topic").insertAdjacentHTML("beforeend", versioning);
});
13 changes: 13 additions & 0 deletions docs/docs/stylesheets/global.css
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,17 @@ TODO: find a way to show all pages in left sidebar
/* Remove cookie consent overlay */
.md-consent__overlay {
display:none;
}

/* Adjust readthedocs flyout menu */
:root {
/* Reduce Read the Docs' flyout font a little bit */
--readthedocs-flyout-font-size: 0.7rem;

/* Reduce Read the Docs' notification font a little bit */
--readthedocs-notification-font-size: 0.8rem;

/* This customization is not yet perfect because we can't change the `line-height` yet. */
/* See https://github.com/readthedocs/addons/issues/197 */
--readthedocs-search-font-size: 0.7rem;
}
3 changes: 2 additions & 1 deletion docs/macros.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ def symlink_external_dirs():

except Exception as e:
logging.error(f"Error creating symlinks: {e}")
raise e
# Don't raise an error here for now
# raise e

# Execute the symlink creation
symlink_external_dirs()
4 changes: 4 additions & 0 deletions docs/mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ extra_css:
- stylesheets/global.css
- stylesheets/notebooks.css

extra_javascript:
- scripts/readthedocs.js

theme:
name: material
custom_dir: overrides
Expand Down Expand Up @@ -115,6 +118,7 @@ plugins:
#- icechunk-python
- assets
- stylesheets
- scripts
- index.md
generate_home_index: false
- mermaid2
Expand Down
7 changes: 6 additions & 1 deletion docs/overrides/main.html
Original file line number Diff line number Diff line change
@@ -1 +1,6 @@
{% extends "base.html" %}
{% extends "base.html" %}

{% block site_meta %}
{{ super() }}
<meta name="readthedocs-addons-api-version" content="1" />
{% endblock %}
Loading