Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,17 @@ True

```

Generate a diagram:
Generate a diagram or get a text representation with f-strings:

```py
>>> print(f"{sm:md}")
| State | Event | Guard | Target |
| ------ | ----- | ----- | ------ |
| Green | cycle | | Yellow |
| Yellow | cycle | | Red |
| Red | cycle | | Green |

```

```python
sm._graph().write_png("traffic_light.png")
Expand Down Expand Up @@ -341,7 +351,7 @@ There's a lot more to explore:
- **`prepare_event`** callback — inject custom data into all callbacks
- **Observer pattern** — register external listeners to watch events and state changes
- **Django integration** — auto-discover state machines in Django apps with `MachineMixin`
- **Diagram generation** — from the CLI, at runtime, or in Jupyter notebooks
- **Diagram generation** — via f-strings (`f"{sm:mermaid}"`), CLI, Sphinx directive, or Jupyter
- **Dictionary-based definitions** — create state machines from data structures
- **Internationalization** — error messages in multiple languages

Expand Down
1 change: 1 addition & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
"sphinx_gallery.gen_gallery",
"sphinx_copybutton",
"statemachine.contrib.diagram.sphinx_ext",
"sphinxcontrib.mermaid",
]

autosectionlabel_prefix_document = True
Expand Down
Loading
Loading