Sphinx extension for creating tabbed views in HTML documentation with syntax highlighting and synchronization.
Sphinx configuration options for customizing sphinx-tabs behavior, builder compatibility, and asset loading.
Specify additional Sphinx builders that should be considered compatible with sphinx-tabs.
sphinx_tabs_valid_builders = []Type: List of strings
Default: [] (empty list)
Context: Extensions configuration
Usage:
# conf.py
sphinx_tabs_valid_builders = ['linkcheck', 'custom_builder']Built-in Compatible Builders: The extension automatically supports these builders:
htmlsinglehtmldirhtmlreadthedocsreadthedocsdirhtmlreadthedocssinglehtmlreadthedocssinglehtmllocalmediaspellingPurpose:
Control whether the extension automatically loads its default CSS stylesheet.
sphinx_tabs_disable_css_loading = FalseType: Boolean
Default: False
Context: HTML builder configuration
Usage:
# conf.py - Disable default CSS to use custom styling
sphinx_tabs_disable_css_loading = TrueWhen to Use:
Note: When disabled, you must provide your own CSS for tab functionality and styling.
Control whether users can close tabs by clicking on the active tab.
sphinx_tabs_disable_tab_closing = FalseType: Boolean
Default: False
Context: HTML builder configuration
Usage:
# conf.py - Disable tab closing functionality
sphinx_tabs_disable_tab_closing = TrueBehavior:
Use Cases:
The configuration values are registered during extension setup.
def setup(app):
"""Register configuration values with Sphinx application"""
app.add_config_value("sphinx_tabs_valid_builders", [], "")
app.add_config_value("sphinx_tabs_disable_css_loading", False, "html", [bool])
app.add_config_value("sphinx_tabs_disable_tab_closing", False, "html", [bool])Configuration Value Registration:
Configuration affects how CSS and JavaScript assets are handled.
def update_context(app, pagename, templatename, context, doctree):
"""Conditionally add CSS/JS assets based on configuration and usage"""
# Respects sphinx_tabs_disable_css_loading setting
# Only loads assets on pages that actually use tabsAsset Loading Logic:
sphinx_tabs_disable_css_loading settingalways vs conditional)# conf.py - Complete sphinx-tabs configuration
extensions = ['sphinx_tabs.tabs']
# Extend builder compatibility
sphinx_tabs_valid_builders = [
'linkcheck', # Allow tabs in link checking
'epub', # Enable for EPUB output
'latex', # Enable for LaTeX (limited functionality)
]
# Custom styling setup
sphinx_tabs_disable_css_loading = True # Use custom CSS
# Always show tab content
sphinx_tabs_disable_tab_closing = True
# Custom CSS can be added via standard Sphinx methods
def setup(app):
app.add_css_file('custom_tabs.css')Tabs not appearing in custom builder:
sphinx_tabs_valid_buildersStyling issues:
sphinx_tabs_disable_css_loading = True is setTab closing not working:
sphinx_tabs_disable_tab_closing settingInstall with Tessl CLI
npx tessl i tessl/pypi-sphinx-tabs