Skip to content

Render Graphviz dot Graphs into SVGs in the browser

License

Notifications You must be signed in to change notification settings

mischnic/dot-svg

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Mar 9, 2020
610b6e9 · Mar 9, 2020

History

14 Commits
May 30, 2019
Mar 9, 2020
Mar 9, 2020
Mar 9, 2020
Mar 9, 2020
Mar 8, 2020
Mar 8, 2020
Mar 9, 2020
Mar 9, 2020
Mar 8, 2020
Mar 9, 2020
Mar 8, 2020
Jun 22, 2019
Mar 8, 2020
Mar 9, 2020

Repository files navigation

dot-svg

Demo

Render .dot Graphs into SVGs right in your browser (or in node without any native module).

Usage

The package exports a promise that resolves to a dotToSVG function. This is necessary because this function can only be called after the WASM module was loaded.

const render = require("@mischnic/dot-svg");

render.then(function(dotToSVG) {
	try {
		const svg = dotToSVG(document.querySelector("textarea").value);
	} catch(e){
		console.error(e);
	}
	// ...
});

For examples, see this node example or this more complete browser example, which is also hosted as a demo at https://dot-wasm.now.sh/


For the most part this is a reduced version fo the unmaintained https://github.com/mdaines/viz.js .