Rendering untrusted diagrams safely

Yes, Pele is designed to draw diagrams written by anyone. Its SVG contains no scripts, event handlers or HTML labels, dangerous links are removed, and oversized diagrams are refused. Your app still has a few jobs, listed below.

What Pele guarantees

Limit Default Option
Diagram text 50,000 characters limit
SVG output 4,000,000 characters outputLimit
Arrows in a flowchart or agent flow 5,000 maxEdges

There's no time limit; if you need one, render in a Web Worker you can stop.

What your app must do

  1. Show errors as text. Use textContent, never innerHTML: error messages can quote the diagram.
  2. Only supply trusted icons. Markup returned by your icons function is inserted as-is.
  3. Treat internal links as note names. For links with internal: true, apply your own navigation rules.
  4. Keep the options to yourself. Don't let diagram authors pass render options or config.

Want your own sanitizer too? Pass sanitize to mount(); it runs before each SVG goes in.

Try to break it in the paste-anything demo. Found a real problem? Report it privately through Pele's security advisories.