d2 icon indicating copy to clipboard operation
d2 copied to clipboard

`d2 play input.d2`

Open alixander opened this issue 1 year ago • 3 comments

What if this command just encoded the input.d2 file and opened it up on playground?

alixander avatar Apr 17 '23 19:04 alixander

for what purpose?

my idea is https://play.d2lang.com/?l=&script=qlDQtVOo5AIEAAD__w%3D%3D& Export=SVG

foobar.d2 xy{ icon:https://play.d2lang.com/?l=&script=qlDQtVOo5AIEAAD__w%3D%3D&Export=SVG }

bo-ku-ra avatar Apr 18 '23 00:04 bo-ku-ra

@bo-ku-ra it's kind of hidden right now, but you can do this:

https://api.d2lang.com/render/svg?script=SspX0NVVyC4FkUWJXIAAAAD__w==&layout=dagre&theme=7&sketch=1

https://play.d2lang.com/?l=&script=qtADBZmVQkZJSUGxlb5-YkGmXopRTmJeul5yfq5-USpIp35xWbp9cXJRZkGJbXBxQYSBX1hYpbOJW3ZouFeEp6Ojo6NLfHy5ra1aTmJlfmmJbUpielGqWklGam6qrblacXZqSXKGrSEXIAAA__8%3D&sketch=1&theme=7&

alixander avatar Apr 28 '23 02:04 alixander

Sorry to revive this topic, but If anyone is interested, the content you see in the script parameter in the URL of the playground is just the diagram code after being compressed with Deflate and than base64url encoded.

Please note that it uses base64url (eg: / is converted to _ and = to %3d) and not plain base64. 😉

danielsitnik avatar Feb 07 '24 01:02 danielsitnik