Open alixander opened 2 years ago
note: Upgraded version with no rate limits that users can pay for. Requested on discord. https://discord.com/channels/1039184639652265985/1039185315685998693/1044721094222942240
This ties into our plan to allow rendering D2 files in github repos within their README.
e.g. d2.dev/github?file=something.svg
and we automatically know which repo it is based on the Referer
header.
ooo we need a D2 playground and it ties into this.
play.d2lang.com
for the live editor.
api.d2lang.com
for the API to text -> svg and with files in repos.
Each example on https://text-to-diagram.com/ then should link to play.d2lang.com
. Including TALA.
Only the API should require a paid license for TALA.
e.g. d2.dev/github?file=something.svg
you mean something.d2
right
Yup!
Hey guys.
I was fascinated by D2 and wanted to contribute somehow, and I saw this issue. So i decided to work on this.
An web-api that takes diagram code and returns an svg. here is the link to go server repo serving this API.
https://playground-d2-lang.netlify.app/
Currently, I don't have a way to host the golang server, because I literally wrote the "hello world" in go first time just yesterday. I thought maybe I could host it in netlify, but that's not gonna work, and heroku is not free anymore. So if you guys have any suggestion, lemme know.
All of this is just an MVP, so I hope we can collaborate to make things better on both playground and API front.
Currently, since I haven't hosted API anywhere, you will need to clone the repo and do the usual go installation, starting go program stuff. Then the playground will interact with that local server and yep that should work.
@YashBhalodi so glad to hear you're interested in helping out!
The API and playground are core to D2 and our user's experience, and it's important to develop a high-quality offering quickly. As such, these are best developed in-house and then open-sourcing it when it's ready. That's not to say multiple playgrounds can't coexist though. Mermaid and Graphviz and PlantUML all have multiple online servers users can choose from, with different pros and cons. Feel free to keep hacking away, and thanks again!
Hi @alixander!
That makes sense. Since I was eager, I have managed to build a basic playground anyone can try. no need to run local server anymore, because I have hosted the api server.
https://playground-d2-lang.netlify.app/
Just wanted to ping here, in case people came looking for it, they can try it out until the official playground is ready.
That is hitting https://d2api.fly.dev/getSvg
and its returning 502. Probably best to turn off the playground for now. Its unusable.
There is an official playground now!
See https://play.d2lang.com/ and https://github.com/terrastruct/d2-playground
We don't have the API/github file rendering yet though.
@alixander Unlike mermaid.live, I see the playground makes a server call for rendering. Is there a plan to not make a server call for live rendering?
Thanks!
@asknet yes, when WASM is done: https://github.com/terrastruct/d2/issues/136
https://news.ycombinator.com/item?id=33710146
Interesting idea. maybe we can have
https://d2.dev/?lksadjlkjadsf
return SVG?