d2 icon indicating copy to clipboard operation
d2 copied to clipboard

ascii art renderer

Open alixander opened this issue 2 years ago • 14 comments

our code is set up well to just plug in an ascii art renderer. i suspect still will be quite hard, though we can treat everything as rectangles to start to make it easier.

alixander avatar Feb 27 '23 22:02 alixander

https://github.com/ironcamel/Graph-Easy

alixander avatar May 05 '23 16:05 alixander

Any hope for this one?

i-am-the-slime avatar Jul 02 '24 11:07 i-am-the-slime

Unfortunately there's no motivating factor right now.

alixander avatar Jul 02 '24 19:07 alixander

💎 $200 bounty • Terrastruct

Steps to solve:

  1. Start working: Comment /attempt #924 with your implementation plan
  2. Submit work: Create a pull request including /claim #924 in the PR body to claim the bounty
  3. Receive payment: 100% of the bounty is received 2-5 days post-reward. Make sure you are eligible for payouts

❗ Important guidelines:

  • To claim a bounty, you need to provide a short demo video of your changes in your pull request
  • If anything is unclear, ask for clarification before starting as this will help avoid potential rework
  • Low quality AI PRs will not receive review and will be closed
  • Do not ask to be assigned unless you've contributed before

Thank you for contributing to terrastruct/d2!

Attempt Started (UTC) Solution Actions
🟢 @mohamed1408 May 05, 2025, 05:37:42 PM #2523 Reward
🟢 @DrSensor Feb 14, 2025, 06:26:41 AM #2353 Reward
🔴 @AkashJana18 Feb 14, 2025, 06:15:41 AM WIP
🟢 @melmathari May 27, 2025, 07:42:08 PM #2526 Reward

algora-pbc[bot] avatar Feb 13 '25 22:02 algora-pbc[bot]

/attempt #924 I would like to work on this issue. Hey @alixander can you shed some more light how to proceed further?

Options

AkashJana18 avatar Feb 14 '25 06:02 AkashJana18

💡 @DrSensor submitted a pull request that claims the bounty. You can visit your bounty board to reward.

algora-pbc[bot] avatar Feb 14 '25 06:02 algora-pbc[bot]

@AkashJana18 since there's a PR open, I'll let him proceed first and ping you if it doesn't work out

alixander avatar Feb 14 '25 06:02 alixander

More context: https://github.com/terrastruct/d2/pull/2353#pullrequestreview-2618517820

alixander avatar Feb 14 '25 18:02 alixander

Hey @DrSensor, would you like to collaborate on this issue, or should I go ahead and start working on it? Or are you planning to handle it solo?

AkashJana18 avatar Feb 15 '25 14:02 AkashJana18

I'll give 72 hours to respond to comments each time. I'll keep it moving to ensure people have a fair shot @AkashJana18

alixander avatar Feb 15 '25 18:02 alixander

@AkashJana18 i came up with other solution using grid based method so i want to handle it solo. i will mention you if i need help.

DrSensor avatar Feb 15 '25 19:02 DrSensor

interesting if it is interconvertible. https://ivanceras.github.io/svgbob-editor/

bo-ku-ra avatar Feb 18 '25 07:02 bo-ku-ra

Well we already have SVG renderers so converting ASCII to SVG with another tool doesn't seem useful

alixander avatar Feb 19 '25 01:02 alixander

umm, talk about SVG is short sighted...

that is great ascii art. i believe that d2's ability to output compatibly is to produce beautiful ascii art output.

bo-ku-ra avatar Feb 19 '25 03:02 bo-ku-ra

/attempt #924 I would like to work on this issue. I have one doubt - I have completed basic shapes, but do we need curves in ascii in connections. Also shall I work?

eg: alphabet -> vowels

Image

Image

Is this Ok?

mohamed1408 avatar May 05 '25 17:05 mohamed1408

yes that's fine. can be only non-curve layouts. e.g. should render the landing page example: https://play.d2lang.com/?script=rJJBjtswDEX3OgWBrm2kzU4FeoruC8JibSG0KIj0pMHAdy9kW00yU2A2s6RI_8__6Bcs6uHVAYRv3SDpdxz3EoDxJot1lMaYyAPxZXv-Aj-pzDEhg000EwwSaOtsZReDh_Pp5ABWt7pEdpVy2TUHYgaTK5XmoWjEHI20vQDohJk8qEmh8CugYWvYjamfF7aYmTxYWXbj1e3-BZPO0YyKe6MO3Y_HtgelFD5xZttAEsdEkKUYcsuzRA-vR6SJ_uAoaW0f1GyQiwykKncmJgVHegdkuHFMgcrHNA75O-7-Yeca4dm4_-eYJ0kELKO61blF26GODTIVleQArjHY5OHr-dTmqupx6_7xzDNeCAZkfjf1RKuvmHCo--yGWzi1IhfqAurk4VytMEdQKi8fSYWomfH2Zr4G21NENbdX7TYZR_r-X6ira39x_8ytSt4N3N8AAAD__w%3D%3D&

alixander avatar May 06 '25 00:05 alixander

Then it is ok. I will finish my work and let you know.

mohamed1408 avatar May 06 '25 06:05 mohamed1408

Hi @alixander it is taking some time. So I wanna let you know the progress I've made. The pending works are some shapes and connections. I share you the sample (partial) that my code can generate now in comparison with your landing page output. Pls let me know if any changes to e done

Image

d2_landing_page_example_ascii.txt

FONT: Consolas Regular FONT SIZE: 12 pt

Image

mohamed1408 avatar May 12 '25 07:05 mohamed1408

How about an approach to make all shapes rectangular? I think d2 can get smaller results.

e.g.

shape: rectangle ╭─────╮ │Default │ ╰─────╯

shape:person (^_^)────╮ │ USER │ ╰──────╯

shape: cloud ☁────╮ │ CLOUD │ ╰─────╯

╭┤☁├─────╮ │ Cloud Drive │ ╰────────╯

╭──┬──────╮ │☁ │Cloud Drive │ ╰──┴──────╯

bo-ku-ra avatar May 12 '25 09:05 bo-ku-ra

That's genius. Is this ok with @alixander ?

mohamed1408 avatar May 12 '25 10:05 mohamed1408

the symbols for all SHAPES need to be determined. also, the design needs to be devised in the hierarchy.

e.g.

╭──┬──────╮
│☁ │Cloud Drive │
╰──┴──────╯



╭┤☁├─────╮
│ Cloud Drive   │
│               │
│ ╭─────╮  │
│ │ Default │ │
│ ╰─────╯  │
╰────────╯

bo-ku-ra avatar May 12 '25 10:05 bo-ku-ra

How about an approach to make all shapes rectangular? I think d2 can get smaller results.

e.g.

shape: rectangle ╭─────╮ │Default │ ╰─────╯

shape:person (^_^)────╮ │ USER │ ╰──────╯

shape: cloud ☁────╮ │ CLOUD │ ╰─────╯

╭┤☁├─────╮ │ Cloud Drive │ ╰────────╯

╭──┬──────╮ │☁ │Cloud Drive │ ╰──┴──────╯

Hi @alixander can you comment on this?

mohamed1408 avatar May 12 '25 10:05 mohamed1408

Yes, that is good to me.

alixander avatar May 15 '25 02:05 alixander

Hi @alixander it is almost complete. Having small problems in connections arrow head.

Wanted to let you know will be completed in 2 days.

mohamed1408 avatar May 19 '25 10:05 mohamed1408

/attempt #924

melmathari avatar May 27 '25 19:05 melmathari

Hi @alixander created new PR #2528 with signed commit. No code changes - same as previous PR #2523.

mohamed1408 avatar May 31 '25 19:05 mohamed1408

🎉🎈 @mohamed1408 has been awarded $200 by Terrastruct! 🎈🎊

algora-pbc[bot] avatar Jul 24 '25 21:07 algora-pbc[bot]