Skip to content

Commit c7e9020

Browse files
committed
docs: add Sphinx directive release notes to 3.1.0
1 parent fa6b97f commit c7e9020

1 file changed

Lines changed: 29 additions & 0 deletions

File tree

docs/releases/3.1.0.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,35 @@
44

55
## What's new in 3.1.0
66

7+
### Sphinx directive for inline diagrams
8+
9+
A new Sphinx extension renders state machine diagrams directly in your
10+
documentation from an importable class path — no manual image generation
11+
needed.
12+
13+
Add `"statemachine.contrib.diagram.sphinx_ext"` to your `conf.py`
14+
extensions, then use the directive in any MyST Markdown page:
15+
16+
````markdown
17+
```{statemachine-diagram} myproject.machines.OrderControl
18+
:events: receive_payment
19+
:caption: After payment
20+
:target:
21+
```
22+
````
23+
24+
The directive supports the same options as the standard `image`/`figure`
25+
directives (`:width:`, `:height:`, `:scale:`, `:align:`, `:target:`,
26+
`:class:`, `:name:`), plus `:events:` to instantiate the machine and send
27+
events before rendering (highlighting the current state).
28+
29+
Using `:target:` without a value makes the diagram clickable, opening the
30+
full SVG in a new browser tab for zooming — useful for large statecharts.
31+
32+
See {ref}`diagram:Sphinx directive` for full documentation.
33+
[#589](https://github.com/fgmacedo/python-statemachine/pull/589).
34+
35+
736
### Bugfixes in 3.1.0
837

938
- Fixes silent misuse of `Event()` with multiple positional arguments. Passing more than one

0 commit comments

Comments
 (0)