Skip to content

Commit

Permalink
Switch docs theme to Furo, refs #1746
Browse files Browse the repository at this point in the history
  • Loading branch information
simonw committed May 20, 2022
1 parent 1465fea commit 1d33fd0
Show file tree
Hide file tree
Showing 9 changed files with 45 additions and 57 deletions.
7 changes: 4 additions & 3 deletions docs/_static/css/custom.css
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
a.external {
overflow-wrap: anywhere;
}

div .wy-side-nav-search > div.version {
color: rgba(0,0,0,0.75);
body[data-theme="dark"] .sidebar-logo-container {
background-color: white;
padding: 5px;
opacity: 0.6;
}
34 changes: 0 additions & 34 deletions docs/_templates/layout.html → docs/_static/js/custom.js
Original file line number Diff line number Diff line change
@@ -1,35 +1,3 @@
{%- extends "!layout.html" %}

{% block htmltitle %}
{{ super() }}
<script defer data-domain="docs.datasette.io" src="https://plausible.io/js/plausible.js"></script>
{% endblock %}

{% block sidebartitle %}

<a href="https://datasette.io/">
<img src="{{ pathto('_static/' + logo, 1) }}" class="logo" alt="{{ _('Logo') }}"/>
</a>

{% if theme_display_version %}
{%- set nav_version = version %}
{% if READTHEDOCS and current_version %}
{%- set nav_version = current_version %}
{% endif %}
{% if nav_version %}
<div class="version">
{{ nav_version }}
</div>
{% endif %}
{% endif %}

{% include "searchbox.html" %}

{% endblock %}

{% block footer %}
{{ super() }}
<script>
jQuery(function ($) {
// Show banner linking to /stable/ if this is a /latest/ page
if (!/\/latest\//.test(location.pathname)) {
Expand Down Expand Up @@ -57,5 +25,3 @@
}
});
});
</script>
{% endblock %}
6 changes: 6 additions & 0 deletions docs/_templates/base.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{%- extends "!base.html" %}

{% block site_meta %}
{{ super() }}
<script defer data-domain="docs.datasette.io" src="https://plausible.io/js/plausible.js"></script>
{% endblock %}
16 changes: 16 additions & 0 deletions docs/_templates/sidebar/brand.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<div class="sidebar-brand centered">
{% block brand_content %}
<div class="sidebar-logo-container">
<a href="https://datasette.io/"><img class="sidebar-logo" src="{{ logo_url }}" alt="Datasette"></a>
</div>
{%- set nav_version = version %}
{% if READTHEDOCS and current_version %}
{%- set nav_version = current_version %}
{% endif %}
{% if nav_version %}
<div class="version">
{{ nav_version }}
</div>
{% endif %}
{% endblock brand_content %}
</div>
11 changes: 11 additions & 0 deletions docs/_templates/sidebar/navigation.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<div class="sidebar-tree">
<ul>
<li class="toctree-l1"><a class="reference internal" href="{{ pathto(master_doc) }}">Contents</a></li>
</ul>
{{ toctree(
collapse=True,
titles_only=False,
maxdepth=3,
includehidden=True,
) }}
</div>
24 changes: 5 additions & 19 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,18 +90,15 @@
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
#
html_theme = "sphinx_rtd_theme"
html_theme = "furo"

# 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 = {
"logo_only": True,
"style_nav_header_background": "white",
"prev_next_buttons_location": "both",
"sidebar_hide_name": True,
}


# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
Expand All @@ -112,20 +109,9 @@
html_css_files = [
"css/custom.css",
]


# Custom sidebar templates, must be a dictionary that maps document names
# to template names.
#
# This is required for the alabaster theme
# refs: http://alabaster.readthedocs.io/en/latest/installation.html#sidebars
html_sidebars = {
"**": [
"relations.html", # needs 'show_related': True theme option to display
"searchbox.html",
]
}

html_js_files = [
"js/custom.js"
]

# -- Options for HTMLHelp output ------------------------------------------

Expand Down
1 change: 1 addition & 0 deletions docs/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ If you want to start making contributions to the Datasette project by installing

.. contents::
:local:
:class: this-will-duplicate-information-and-it-is-still-useful-here

.. _installation_basic:

Expand Down
1 change: 1 addition & 0 deletions docs/plugin_hooks.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ For example, you can implement the ``render_cell`` plugin hook like this even th
.. contents:: List of plugin hooks
:local:
:class: this-will-duplicate-information-and-it-is-still-useful-here

.. _plugin_hook_prepare_connection:

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def get_version():
setup_requires=["pytest-runner"],
extras_require={
"docs": [
"sphinx_rtd_theme",
"furo==2022.4.7",
"sphinx-autobuild",
"codespell",
"blacken-docs",
Expand Down

0 comments on commit 1d33fd0

Please sign in to comment.