Skip to content

bauglir/Kroki.jl

Repository files navigation

Kroki.jl

Actions Status Codecov Coveralls [Semantic Release] ColPrac: Contributor's Guide on Collaborative Practices for Community Packages

Enables a wide array of textual diagramming tools, such as Graphviz, Mermaid, PlantUML, svgbob and many more within Julia through the Kroki service. It works in environments capable of rendering images:

Kroki Pluto Demo

and even in the REPL for a subset of the supported diagrams:

Kroki REPL Demo

See the documentation for more information and please follow the contribution guidelines when contributing.

Usage

Install Kroki through Julia's package manager

(v1.10) pkg> add Kroki

Construct diagrams using the Diagram type or any of the available string literals. Then either rely on the available Base.show overloads, or call the render function with a specific output format, to visualize them.

julia> using Kroki

julia> plantuml"""
       Kroki -> Julia: Hello!
       Julia -> Kroki: Hi!
       Kroki -> Julia: Can I draw some diagrams for you?
       Julia -> Kroki: Sure!
       """
     ┌─────┐                            ┌─────┐
     │Kroki│                            │Julia│
     └──┬──┘                            └──┬──┘
        │             Hello!               │
        │─────────────────────────────────>│
        │                                  │
        │               Hi!                │
        │<─────────────────────────────────│
        │                                  │
        │Can I draw some diagrams for you? │
        │─────────────────────────────────>│
        │                                  │
        │              Sure!               │
        │<─────────────────────────────────│
     ┌──┴──┐                            ┌──┴──┐
     │Kroki│                            │Julia│
     └─────┘                            └─────┘

Note: ASCII art diagrams, as shown above, are only supported for a subset of PlantUML diagrams. All other diagram types are better supported in environments like Documenter.jl, Pluto.jl or Jupyter.