Sphinx Design 组件#

在本页中,您将找到用户界面组件,例如徽章、按钮、卡片和选项卡。

本页中的组件**并非由 PyData 主题提供**。它们由 Sphinx Design ( Sphinx 插件)提供。这意味着如果您希望使用本页中的组件,您必须单独安装 Sphinx Design 并将其添加到您的 conf.py 中。

参见

要将 Sphinx Design 插件添加到您的 Sphinx 项目中,请参阅 Sphinx Design - 入门

Contributors to both projects have worked to ensure compatible styling so that Sphinx Design components look and feel consistent with the PyData Theme.

This page shows you how the Sphinx Design components would look on your site if you were to use them in combination with the PyData Theme. Sphinx Design also provides a PyData-themed version of the Sphinx Design site; however, their site use an older version of this theme.

Any customizations you make to the theme could affect how these components appear on your site. So what you see on this page might not match exactly what you see on your site even if your site uses this theme.

Cards#

Only heading

Only body.

But with multiple text paragraphs.

Heading and body

Content of the third card.

Sample badge

A card with a dropdown menu
Click to expand dropdown

Hidden content

A clickable card

Don't forget to add the alternative text with link-alt!

Clickable cards - Sphinx Design docs

panel 1 header

panel 1 content more content

panel 2 header

panel 2 content

Tabs#

int main(const int argc, const char **argv) {
    return 0;
}
def main():
    return
class Main {
    public static void main(String[] args) {
    }
}
function main()
end
PROGRAM main
END PROGRAM main

Copybuttons#

sphinx-copybutton adds a copy button to each of your code cells. You can see it in action by hovering over the code cell below:

print("A copybutton in the top-right!")

nbsphinx

If your documentation site uses both nbsphinx and Sphinx-copybutton, you will want to add the following line to your conf.py file to prevent the copy button from appearing on top of notebook cell numbers:

conf.py#
copybutton_selector = ":not(.prompt) > div.highlight pre"

Toggle buttons#

sphinx-togglebutton allows you to convert admonitions into toggle-able elements.

A standalone toggle button!