Skip to content

Commit fa6b97f

Browse files
committed
feat: add statemachine-diagram Sphinx directive for inline diagram rendering
Add a Sphinx extension that renders state machine diagrams inline in docs from an importable class path, eliminating manual DotGraphMachine/write_png boilerplate. Supports standard image/figure options (width, height, scale, align, target, class, name) and state-machine-specific options (events, caption, figclass). Key features: - Inline SVG rendering (no intermediate files) - :events: option to instantiate and advance the machine before rendering - :target: (empty) auto-generates a standalone SVG for full-size zoom - Responsive sizing: intrinsic width becomes max-width, scales down on narrow viewports - Compatible with any Sphinx theme (uses native align-center/left/right classes) Refactor diagram.md to use the directive for the visual showcase, replacing doctest+write_png workflow. Extract showcase machines to tests/machines/ and use literalinclude with :pyobject: to display source code. Reorganize the page narrative: _graph() as primary entry point, DotGraphMachine for advanced customization.
1 parent e16b2f0 commit fa6b97f

43 files changed

Lines changed: 780 additions & 252 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

docs/conf.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@
5151
"sphinx.ext.autosectionlabel",
5252
"sphinx_gallery.gen_gallery",
5353
"sphinx_copybutton",
54+
"statemachine.contrib.diagram.sphinx_ext",
5455
]
5556

5657
autosectionlabel_prefix_document = True

0 commit comments

Comments
 (0)