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
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.
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/