kroki

Last updated:

0 purchases

kroki Image
kroki Images
Add to Cart

Description:

kroki

Kroki.dart #








This is a simple class to package up and send requests to the Kroki.io web service.
A live editor to editing diagrams that Kroki supports can be found at niolesk.top
Features and bugs #
Please file feature requests and bugs at the issue tracker.

Example with package:markdown #
Here is an example of using the Kroki package with package:markdown to support fenced code blocks that contain diagrams.
import 'package:kroki/kroki.dart';
import 'package:markdown/markdown.dart' as markdown;

final Kroki kroki = Kroki();

class DiagramTransfomer extends markdown.CodeBlockTransformer {
@override
markdown.Node? transformCodeBlock(
String codeBlockType, String rawCodeBlock, markdown.BlockParser parser) {
final markdown.AsyncText asyncText = markdown.AsyncText(
kroki.convertDiagram(codeBlockType, rawCodeBlock), parser,
uncompletedFutureTextValue:
rawCodeBlock // fall back to showing diagram source
);
return asyncText;
}

DiagramTransfomer() :
super(handledCodeBlockTypes:KrokiDiagramEndpoints.supportedEndpoints);
}

final diagramTransformingFencedCodeBlock =
markdown.TransformableFencedCodeBlockSyntax([DiagramTransfomer()]);

main() {
final finalHtml = await markdown.markdownToHtmlWithAsyncTransforms(markdownSource,
blockSyntaxes: [diagramTransformingFencedCodeBlock],
extensionSet: markdown.ExtensionSet.gitHubWeb);
}

final String markdownSource = r'''
# Example mermaid diagram

```mermaid
graph TD;
A-->B;
A-->C;
B-->D;
C-->D;
```
''';


copied to clipboard

License:

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Files In This Product:

Customer Reviews

There are no reviews.