alixanderwang 7 hours ago

Hello fellow devs. Just wanted to share a new feature we added this morning, though it's very alpha stage (already someone's filed a github issue for it hah)

If you want to skip the blog post and poke around directly: https://play.d2lang.com/?script=qlDQtVOotFLIyFTwSEzOTi1S8Est...

For a bigger example: https://play.d2lang.com/?script=rJJBjtswDEX3OgWBrm2kzU4Feoru...

  • rng-concern 5 hours ago

    I thought your playground wasn't working as it renders black text on black background. Maybe I have darkmode enabled or something. Other renderers work, but ascii is invisible.

    • alixanderwang 5 hours ago

      Ah right, forgot to test the update with dark mode. Thanks for letting me know!

      edit: fixed

smusamashah 4 hours ago

I maintain a list of browser based text to diagram tools (which I have shared a number of times here). I recently realised that the online version of D2 does NOT work solely in browser, diagram's are generated by backend servers.

Can D2 work in browser by itself? Does the extension mentioned in the post work offline? (lots of tools do)

  • alixanderwang 4 hours ago

    It does now! (As of a week ago)

    Check out the network tab in the d2 playground. It's powered by d2.js, a wrapper around a wasm port of d2, which we've recently been working on. Not super officially ready yet but soon to be, and will be a separate announcement.

  • rendall 4 hours ago

    ~~May I see that list, please?~~

    Edit: found it! Thanks.

tombert 3 hours ago

This is awesome.

I hadn't heard of D2, but I love the idea that I can create my charts directly in Neovim in the terminal to get a rough draft, and do a final render with a pretty picture.

I will be playing with this shortly.

  • aidenn0 an hour ago

    D2 already supports a live-updating HTTP server serving a live-updating .svg, so if you tile a browser with vim, you can already get live-updates.

    I discovered D2 about a year ago, and I use it for all of my diagrams now.

    • tombert an hour ago

      Yeah but that doesn't feel nearly as nerdy and cool :)

      There's a sort of elegance to ASCII rendering.

  • mtillman 3 hours ago

    I typically use Moondraw for ASCII diagrams but this is pretty great for when you're already in Vim.

CuriouslyC 2 hours ago

This will be super helpful for saving context feeding architecture diagrams to LLMs.

robertlagrant 7 hours ago

This looks cool. And I saw the previous post you got C4 support! I'm just about to do some C4 things; I'll check it out.

reactordev 6 hours ago

The vim extension is such a flex...

  • Graziano_M 4 hours ago

    Yeah, but weird/unfortunate that it's written in vimscript.

    • gsinclair 3 hours ago

      How on earth can it be weird that a vim extension is written in vimscript?!

      • stavros 2 hours ago

        Well imagine a Java extension being written in Javascript...

jiehong 4 hours ago

I’ve been using d2 for sequences diagrams or migration diagrams and I like it!

This new feature is interesting!

eric-p7 6 hours ago

Not to be confused with The D Programming Language, which has a similar domain (dlang.org), and is currently on version 2.

jillesvangurp 6 hours ago

Llm to text to diagram is the killer workflow these days.

The key challenge is making these things presentable. Optimizing them for human editability is a secondary concern at this point. This is where a lot of these tools fall apart.

  • justonceokay 5 hours ago

    I use LLM to tell my children bedtime stories and to wish my wife goodnight. Saves me a lot of time and energy

  • billyp-rva 6 hours ago

    > Llm to text to diagram is the killer workflow these days.

    It's useful, but I think only marginally. When using a diagrams-as-code tool, having an LLM write it for you gets you up and running faster, but long term you have more control (and no hallucinations) just writing the code yourself. It'll probably be fewer keystrokes in the end. Doubly so if your diagrams-as-code tool has decent autocomplete.

    • thejazzman 3 hours ago

      i think d2 looks sick , and i'm not op, but i do love just describing my system and telling the LLM to draw it. so having it "draw" d2 seems like a great new step?

      when you want to make changes, you update your docs/design and repeat. think system design interview but you skip drawing it yourself at all and then sanity check your own work by interpreting the resulting graph etc

sidewndr46 5 hours ago

Does this mean a quine is possible?

  • cluckindan 3 hours ago

    Yes, but the only one I found on the playground is all newlines and spaces.

    In escaped form:

        \x20\n\x20\n\x20\n\n
bxpn77 5 hours ago

Super cool!

mielebauknecht 2 hours ago

wow! Now d2 is turned into something that is acually useful!