Configuration¶
All configuration options use the oceanid_ prefix in your Sphinx conf.py.
Rendering¶
oceanid_version¶
Type |
|
Default |
|
The beautiful-mermaid library version loaded from CDN. Ignored when oceanid_local_js is set.
oceanid_version = "1.1.3"
oceanid_local_js¶
Type |
|
Default |
|
Path to a local beautiful-mermaid JS bundle. When set, the CDN URL is not used. The path is relative to the HTML output root (the value is used as-is as a script URL).
oceanid_local_js = "_static/beautiful-mermaid.js"
oceanid_unsupported_action¶
Type |
|
Default |
|
Action taken when an unsupported diagram type is encountered. beautiful-mermaid supports 6 diagram types (flowchart, sequenceDiagram, classDiagram, stateDiagram, erDiagram, xychart-beta). For any other type, sphinx-oceanid produces a build warning or raises an error — never silent degradation.
Valid values: "warning", "error".
# Fail the build on unsupported diagram types
oceanid_unsupported_action = "error"
Theme¶
oceanid_theme¶
Type |
|
Default |
|
Theme name for diagram rendering. When set to "auto", the theme is detected from the Sphinx HTML theme’s dark/light mode at runtime using CSS variables. Set to a specific theme name to override auto-detection.
oceanid_theme = "auto"
oceanid_theme_dark¶
Type |
|
Default |
|
Theme used when oceanid_theme = "auto" and the page is in dark mode.
oceanid_theme_dark = "zinc-dark"
oceanid_theme_light¶
Type |
|
Default |
|
Theme used when oceanid_theme = "auto" and the page is in light mode.
oceanid_theme_light = "zinc-light"
Layout¶
oceanid_width¶
Type |
|
Default |
|
CSS width for the diagram container. Accepts any valid CSS width value.
oceanid_width = "80%"
oceanid_height¶
Type |
|
Default |
|
CSS height for the diagram container. Accepts any valid CSS height value.
oceanid_height = "400px"
Feature Flags¶
oceanid_zoom¶
Type |
|
Default |
|
Enable pan-and-zoom interaction on all diagrams globally. Uses native Pointer Events and SVG viewBox manipulation — no d3.js dependency. Mouse wheel to zoom, drag to pan, double-click to reset, pinch to zoom on touch devices.
To enable zoom on individual diagrams only, use the :zoom: directive option instead.
oceanid_zoom = True
oceanid_fullscreen¶
Type |
|
Default |
|
Enable a fullscreen button on all diagrams. Clicking it opens the diagram in a viewport-sized modal overlay. Close with Escape key, clicking outside, or the close button.
oceanid_fullscreen = True
Quick reference¶
Setting |
Type |
Default |
Description |
|---|---|---|---|
|
|
|
beautiful-mermaid library version |
|
|
|
Path to local JS bundle |
|
|
|
Action for unsupported diagram types |
|
|
|
Theme name or auto-detection |
|
|
|
Dark theme for auto mode |
|
|
|
Light theme for auto mode |
|
|
|
Diagram container width |
|
|
|
Diagram container height |
|
|
|
Enable zoom globally |
|
|
|
Enable fullscreen modal |
|
|
|
Fullscreen button character |
|
|
|
Button opacity (0–100) |
Migrating from sphinxcontrib-mermaid¶
sphinx-oceanid uses the oceanid_ prefix to coexist with sphinxcontrib-mermaid during migration. The table below maps common sphinxcontrib-mermaid settings to their sphinx-oceanid equivalents:
sphinxcontrib-mermaid |
sphinx-oceanid |
Notes |
|---|---|---|
|
|
beautiful-mermaid version, not standard Mermaid.js |
|
— |
Not applicable; beautiful-mermaid handles initialization |
|
— |
Always SVG (beautiful-mermaid renders SVG only) |
— |
|
New: automatic dark/light theme detection |
— |
|
New: built-in pan & zoom |
— |
|
New: fullscreen modal |
To migrate:
Replace
sphinxcontrib.mermaidwithsphinx_oceanidin theextensionslist.Replace
mermaid_prefixed settings with the correspondingoceanid_settings.Remove settings that have no equivalent (e.g.,
mermaid_init_js,mermaid_output_format).Verify that all diagrams use supported types. Unsupported types produce warnings by default.