deno_encode_kroki
v0.8.1
Published
encode-diagram deno client/library from [Kroki](https://docs.kroki.io/kroki/)
Downloads
4
Readme
deno_kroki
encode-diagram deno client/library from Kroki
package registry
deno
https://deno.land/x/[email protected]
npm(esmodule)
https://esm.sh/[email protected] https://esm.sh/[email protected]/types/mod.d.ts
usage
// npm(esmodule)
// import { encodeKroki } from "deno_encode_kroki";
// deno
import { encodeKrokiURL, convertKroki, DiagramType, OutputFormat } from "./lib/mod.ts";
const diagramSource = `digraph G {
Hello->World
}`;
//example: https://kroki.io
const baseURL = Deno.env.get("KROKI_URL");
const diagramType = DiagramType.Graphviz; // "graphviz";
console.log(encodeKrokiURL(baseURL!, diagramType, OutputFormat.Png, diagramSource));
convertKroki(encodeKrokiURL(baseURL!, diagramType, OutputFormat.Png, diagramSource), "./hello.png");
convertKroki(encodeKrokiURL(baseURL!, diagramType, OutputFormat.Svg, diagramSource), "./hello.svg");
// https://kroki.io/graphviz/png/eNpLyUwvSizIUHBXqOZSAAKP1JycfF278PyinBSuWgCRBQla