Skip to main content

Sphinx theme for Xanadu open-source Python packages

Project description

Xanadu Sphinx Theme

The Xanadu Sphinx Theme (XST) is a Sphinx theme used for open-source Xanadu software projects.

A fork of the Guzzle Sphinx theme, the theme has the following features:

  • Responsive. Fluid layout that automatically adjusts for phone, tablet, and computer screens.

  • LaTeX Macros. Comes with built-in support for MathJAX and common predefined quantum optics LaTeX macros.

  • Cohesive Design. Unifies the appearance of all Xanadu Sphinx documentation.

Installation

The Xanadu Sphinx Theme requires Python 3.7 or later. The latest version of the XST can be installed directly from the GitHub repository using pip:

pip install xanadu-sphinx-theme

Getting Started

Once installed, simply add or modify the following variables of your Sphinx conf.py configuration file to start using the Xanadu Sphinx Theme:

from xanadu_sphinx_theme import templates_dir

# Add Xanadu Sphinx Theme autosummary templates
templates_path = [templates_dir()]

html_theme = "xanadu"

html_theme_options = {
    "navbar_name": "Example Project",
    "navbar_logo_colour": "#123456",

    "navbar_home_link": "https://example.com",

    "github_repo": "",
    "navbar_left_links": [
        {
            "name": "Tutorials",
            "href": "https://example.com/tutorials",
            "img": "_static/tutorial.png",
            "img_width": "30px",
        },
        {
            "name": "Install",
            "href": "install.html",
        },
        {
            "name": "Documentation",
            "href": "index.html",
            "active": True,
        }
    ],

    "navbar_right_links": [
        {
            "name": "FAQ",
            "href": "https://example.com/faq.html",
            "icon": "fas fa-question",
        },
        {
            "name": "GitHub",
            "href": "https://github.com/XanaduAI/example",
            "icon": "fab fa-github",
        }
    ],

    "extra_copyrights": [
        "TensorFlow, the TensorFlow logo, and any related marks are "
        "trademarks of Google Inc."
    ],

    "google_analytics_tracking_id": "UA-116279123-2",

    "prev_next_button_colour": "#b13a59",
    "prev_next_button_hover_colour": "#712b3d",
    "toc_marker_colour": "#b13a59",
    "table_header_background_colour": "#ffdce5",
    "border_colour": "#b13a59",
    "text_accent_colour": "#b13a59",
}

Configuration

The Xanadu Sphinx Theme supports the following options. These should be added to the html_theme_options dictionary in your conf.py file.

google_analytics_tracking_id

Google Analytics tracking ID to enable website analytics.

github_repo

The GitHub organization and repository associated with the documentation. E.g., for a GitHub repository https://github.com/Organization/repo, this should be "github_repo": "Organization/repo".

search_on_pennylane_ai

If True, navigating to search.html (or using the search box) will redirect users to https://pennylane.ai/search with the appropriate query parameters.

command_palette_enabled

When set to True, the command palette is activated, enabling users to easily search and navigate all content within pennylane.ai.

Table of contents

The following options customize the table of contents.

toc_overview

If True, the project name, and a link to the homepage index.rst, is included in the left-hand table of contents.

toc_global

Whether to show the global table of contents by default via the left sidebar. If False, then the left sidebar will be disabled.

toc_subset

If set to True, and the current page has no local table of contents, the right-hand table of contents will instead display the current subset of the document tree. That is, the right-hand ToC will display the location in the document of the current page. If False, and the current page has no local table of contents, no right-hand ToC will be shown.

relations

If True, then Next and Previous buttons are included at the bottom of every page, allowing navigation according to the table of contents.

Style Colours

The following options allow the colours of various theme elements to be altered. These should be fully qualified CSS color specifiers such as #004B6B or #444.

border_colour

Border colour of accent rules and table headers.

code_colour

Colour of code blocks and teletype text. Defaults to #8D1A38.

prev_next_button_colour and prev_next_button_hover_colour

Colours of the “Next” and “Previous” navigation buttons located at the bottom of most pages.

social_icon_colour

Colour of the social icons.

table_header_background_colour

Background colour of table headers.

text_accent_colour

Accent colour for text such as download links.

toc_marker_colour

Colour of the marker beside the current ToC entry.

toc_mobile_heading_colour and toc_mobile_heading_background_colour

Text and background colours of the mobile ToC heading.

Directives

The Xanadu Sphinx Theme implements the custom Sphinx directives listed below. For more information, consult the relevant Python module in the directives package.

Community Card

<No example is available yet.>

Details

.. details::
    :title: Usage Details

    In general, the block takes :math:`D` parameters and **must** have the following signature:

    .. code-block:: python

        unitary(parameter1, parameter2, ... parameterD, wires)

    For a block with multiple parameters, ``n_params_block`` is equal to the number of parameters in ``block``.
    For a block with a single parameter, ``n_params_block`` is equal to the length of the parameter array.
Details

Index Card

.. index-card::
    :name: Using PennyLane
    :link: introduction/pennylane.html
    :description: A guided tour of the core features of PennyLane
Index Card

Title Card

.. title-card::
    :name: 'lightning.qubit'
    :description: A fast state-vector qubit simulator written in C++
    :link: devices.html
Title Card

YouTube Video

<No example is available yet.>

Support

If you are having issues, please let us know by posting the issue on our Github issue tracker.

License

The Xanadu Sphinx Theme is free and open source, released under the Apache License, Version 2.0.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

xanadu_sphinx_theme-0.18.0.tar.gz (49.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

xanadu_sphinx_theme-0.18.0-py3-none-any.whl (55.0 kB view details)

Uploaded Python 3

File details

Details for the file xanadu_sphinx_theme-0.18.0.tar.gz.

File metadata

  • Download URL: xanadu_sphinx_theme-0.18.0.tar.gz
  • Upload date:
  • Size: 49.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.25

File hashes

Hashes for xanadu_sphinx_theme-0.18.0.tar.gz
Algorithm Hash digest
SHA256 1fac2c831bdb7d18be0c22a9175838b0c33b995da5f0747c9800747f935a3326
MD5 df5278d03ab7cfbb091de903475986a5
BLAKE2b-256 7628ae4809d2e7f97c3ebf95249d51bb8d8e50036da10911708a711044b3b859

See more details on using hashes here.

File details

Details for the file xanadu_sphinx_theme-0.18.0-py3-none-any.whl.

File metadata

File hashes

Hashes for xanadu_sphinx_theme-0.18.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2b356a6eaef567d9fb93dab0bb074f8276ceaf83dc96d086d9dfc66a1743ce5b
MD5 99b71eb74e539abb9bdc63190954ebdc
BLAKE2b-256 d761a961054513bd5aeaf52a2564a13852685939cf3cdbb8e065e876ae26d7c2

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page