Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Diagram Providers & Dependencies

Kroki-rs uses the Provider Pattern to decouple the API from rendering logic.

The Provider PatternΒΆ

All providers implement the DiagramProvider trait. This ensures a consistent interface for validation and generation.

#[async_trait]
impl DiagramProvider for MyProvider {
    fn validate(&self, source: &str) -> DiagramResult<()> { ... }
    async fn generate(&self, source: &str, format: &str) -> DiagramResult<Vec<u8>> { ... }
}

System DependenciesΒΆ

Kroki-rs delegates rendering to specialized external tools. Here is the dependency map:

ProviderRuntimeExternal DependencyStatus
GraphvizNative (C)graphviz (dot)Core
D2Native (Go)d2Core
DitaaJRE (Java)ditaaLegacy Support
MermaidBrowser (JS)chromiumNative Browser
BPMNBrowser (JS)chromiumNative Browser
VegaBrowser (JS)chromiumNative Browser

Adding a New ProviderΒΆ

  1. Create src/diagrams/providers/new_tool.rs.

  2. Use define_provider!(NewToolProvider).

  3. Register in registry.rs and update capabilities.rs.

See Coding Standards for implementation details.