Skip to content

Latest commit

 

History

107 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Mermaid Native

Mermaid-compatible diagram parsing and native rendering implemented with Kotlin Multiplatform. The project does not use a WebView or JavaScript at runtime.

This is an independent, non-official implementation. Compatibility is declared per diagram family and syntax feature; unsupported syntax fails with typed diagnostics rather than silently rendering a different diagram.

Modules

  • mermaid-core: parser, typed AST, and diagnostics.
  • mermaid-layout-api: toolkit-neutral scene graph, draw commands, and layout SPI.
  • mermaid-layout-simple: deterministic Apache-2.0 starter layout.
  • mermaid-render-svg: common SVG serializer.
  • mermaid-kuikly: reserved module for the future Kuikly Canvas/Text adapter; the native renderer is not implemented yet.
  • mermaid-testkit: compatibility fixtures and geometry goldens.

All artifacts share one version and are published under build.raft.mermaid.

Read the optimized documentation site at https://botiverse.github.io/mermaid-native/. ELK support is deliberately outside the Apache-2.0 core; any future layout-elk artifact must carry its own EPL-2.0 obligations.

License

Mermaid Native is licensed under the Apache License, Version 2.0. See LICENSE and NOTICE. Compatibility fixtures and other third-party material retain their upstream licenses and attribution as listed in NOTICE; the project license does not relicense those materials.

Current parser support

The first supported syntax slices are:

  • sequenceDiagram with one A->>B message;
  • flowchart with one A-->B edge.

Parser support is covered on Android and iOS. Layout, SVG, and native host support remain separate compatibility entries and are not implied by parser support.

Quick start

val result = MermaidParser.parse("flowchart LR; A[Start] --> B[Finish]")
when (result) {
    is MermaidParseResult.Success -> {
        // Pass the typed diagram to a layout/render module.
    }
    is MermaidParseResult.Failure -> result.diagnostics.forEach(::println)
}

The parser is deliberately fail-closed: syntax outside the declared support matrix returns a typed diagnostic instead of silently changing diagram type or dropping statements. See compatibility, architecture, and testing.

Examples

The samples directory contains flowchart and sequence sources adapted from the pinned beautiful-mermaid corpus and same-named SVG goldens generated by the common deterministic layout/renderer. The same inputs have normalized AST expectations in mermaid-testkit, so examples are executed by the multiplatform test suite instead of drifting as documentation-only text.

Contributing

This is an independent, non-official Mermaid-compatible implementation. New syntax needs a support-matrix entry, parser tests, a negative/unsupported case, and a fixture or differential vector before it is considered complete. See CONTRIBUTING.md.

About

Mermaid-compatible native diagram parser and renderer for Kotlin Multiplatform

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages