graph LR A[git push] --> B["crates.io\ntarball"] B --> C["docs.rs build\n(nightly rustdoc)"] C --> D["HTML output\npublished"] E["docs/images/*.png"] -.->|"โ NOT included"| D style E fill:#ffcccc,stroke:#cc0000 style D fill:#fff3e0,stroke:#e65100
graph TD subgraph "Source" A["docs/examples/*.py"] --> B[".. plot:: directive\nin .rst file"] end subgraph "Build (sphinx-build)" B --> C["matplotlib\nsphinxext.plot_directive"] C --> D["Execute Python\nโ generate PNG"] D --> E["Embed PNG\nin HTML output"] end subgraph "Result" E --> F["_build/html/plot_directive/\n*.png"] E --> G["HTML with\n<img src=...>"] end style A fill:#e8f5e9,stroke:#2e7d32 style B fill:#e3f2fd,stroke:#1565c0 style C fill:#fff3e0,stroke:#e65100 style F fill:#f3e5f5,stroke:#6a1b9a style G fill:#f3e5f5,stroke:#6a1b9a
graph TD subgraph "Development" A["docs/images/*.png"] --> B["embed_image! macro\n(compile-time base64)"] C["Cargo.toml\nfeatures = [doc-images]"] --> D["cargo doc\n--features doc-images"] B --> D D --> E["local HTML\nwith data: URIs"] end subgraph "docs.rs" F["Cargo.toml\nmetadata.docs.rs"] --> G["docs.rs build\n(nightly rustdoc)"] A --> G G --> H["docs.rs HTML\nwith data: URIs"] end subgraph "Browser" E --> I["<img src='data:...'>\nzero network requests"] H --> I end style A fill:#e8f5e9,stroke:#2e7d32 style B fill:#e3f2fd,stroke:#1565c0 style E fill:#fff3e0,stroke:#e65100 style H fill:#fff3e0,stroke:#e65100 style I fill:#f3e5f5,stroke:#6a1b9a
graph TD subgraph "Python (Sphinx)" A1["conf.py\nextensions"] --> B1["sphinx-build"] C1["*.rst with\n.. figure::"] --> B1 D1["images/"] -->|"auto-copy"| B1 E1["*.rst with\n.. plot::"] -->|"matplotlib\nexecute & capture"| B1 B1 --> F1["HTML + _images/\non ReadTheDocs"] end subgraph "Rust (rustdoc)" A2["Cargo.toml\nfeatures"] --> B2["cargo doc"] C2["lib.rs with\nembed_image!"] -->|"base64 encode"| B2 D2["docs/images/"] --> C2 B2 --> E2["HTML with\ndata: URIs\non docs.rs"] end style A1 fill:#e8f5e9,stroke:#2e7d32 style C1 fill:#e3f2fd,stroke:#1565c0 style E1 fill:#c8e6c9,stroke:#2e7d32 style F1 fill:#fff3e0,stroke:#e65100 style A2 fill:#e8f5e9,stroke:#2e7d32 style C2 fill:#e3f2fd,stroke:#1565c0 style E2 fill:#fff3e0,stroke:#e65100