Skip to content

help: small demo page #26

@setop

Description

@setop

I try to make a simple web page that : loads viz.js, put some dot in a textarea, have a button to render the diagram and put the result in a div.

I've tried

<html>
<body>
<textarea id="dot">digraph{ A -> B; }</textarea>
<p>let's diag</p>
<div id="diag"></div>
</body>
</html>
<script type="module" src="main.cdn.js"></script>
<script>
input = document.getElementById("dot").value;
dot2svg(input)
  .then((svgString) => {
    console.log(svgString);
  })
  .catch((error) => {
    console.error(error);
  });
</script>

main.cdn.js is basically what is proposed in the README.

I've tried many ways (declare my code as a module, use export, etc.).
But I always end up with Uncaught ReferenceError: dot2svg is not defined.

Can someone please a small demo page ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions