mermaid_core 0.3.0 copy "mermaid_core: ^0.3.0" to clipboard
mermaid_core: ^0.3.0 copied to clipboard

Pure Dart port of mermaid.js: detect, parse and lay out 28 diagram types into a backend-agnostic scene, with an SVG renderer and a CLI. No Flutter.

example/mermaid_core_example.dart

// Renders a flowchart to SVG with the pure-Dart core.
//
// Run: dart run example/mermaid_core_example.dart
import 'package:mermaid_core/mermaid_core.dart';

void main() {
  const source = '''
graph TD
  A[Start] --> B{Is it working?}
  B -->|Yes| C[Ship it]
  B -->|No| D[Debug]
  D --> B
''';

  const mermaid = Mermaid(measurer: ApproximateTextMeasurer());
  final scene = mermaid.render(source);

  // The scene is backend-agnostic; here we render it to an SVG string.
  print(renderSceneToSvg(scene));

  // You can also inspect the detected type and scene size.
  // (Printed to stderr so stdout stays valid SVG.)
}
1
likes
150
points
1.29k
downloads

Documentation

API reference

Publisher

verified publisherroszkowski.dev

Weekly Downloads

Pure Dart port of mermaid.js: detect, parse and lay out 28 diagram types into a backend-agnostic scene, with an SVG renderer and a CLI. No Flutter.

Repository (GitHub)
View/report issues
Contributing

Topics

#mermaid #diagram #svg #visualization

License

unknown (license)

Dependencies

elk, katex_dart, meta, path_parsing

More

Packages that depend on mermaid_core