Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question: Generate URL for d2 files for play.d2lang.com preview #67

Open
edwinjhlee opened this issue Dec 13, 2024 · 3 comments
Open

Question: Generate URL for d2 files for play.d2lang.com preview #67

edwinjhlee opened this issue Dec 13, 2024 · 3 comments

Comments

@edwinjhlee
Copy link

edwinjhlee commented Dec 13, 2024

Hello D2 community,

I'm trying to understand how to encode D2 code into the URL for the online playground: https://play.d2lang.com/

I've noticed the script URL parameter appears to contain encoded D2 code, for example: https://play.d2lang.com/?script=qlDQtVOo5AIEAAD__w%3D%3D. Is there any official documentation that explains this encoding scheme and other URL parameters for the playground?

Thank you

@edwinjhlee edwinjhlee changed the title Feature Request: Generate URL for d2 files for play.d2lang.com preview Question: Generate URL for d2 files for play.d2lang.com preview Dec 13, 2024
@edwinjhlee
Copy link
Author

edwinjhlee commented Dec 13, 2024

@edwinjhlee
Copy link
Author

edwinjhlee commented Dec 13, 2024

I notice currently using compress/flate and basd64 as encoding in the playgroud url.
It is very hard to do such encoding in the shell scenario with curl and native commands.
Is there any other way to pass the file content to the playground ? any attribute other than 'script=' ?

@alixander

BTW, is there any documents about the api ?

https://api.d2lang.com/render/svg?script=qlDQtVOo5AIEAAD__w%3D%3D&

@Sayi
Copy link

Sayi commented Dec 13, 2024

I am also looking for how to deploy this API service, looking forward to your reply

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants