Skip to content

D2 api which takes d2 diagram code as input and return a diagram generated as svg/html

Notifications You must be signed in to change notification settings

YashBhalodi/d2api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

D2 API

D2 is modern diagram scripting language. I was fascinated by it and noticed that one of the issue was about building a web-playground where people can try things out without much fuss of setting it up locally.

This API was built to support the project of playground

API Deploy details

URL to target: https://d2api.fly.dev/

Endpoint: /getSvg Request type: POST Payload type: json Payload details:

{
    "diagramCode": "# D2 script here.
    x -> y"
}

Response type: text/html Response: The generated svg for the provided D2 script, if the D2 script is valid.

D2 Playground

Using this API, I have built a basic D2 playground where you can play around and see if D2 fits your taste and use case.

Playground URL: https://d2play.yashbhalodi.me/

About

D2 api which takes d2 diagram code as input and return a diagram generated as svg/html

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published