Hacker News

Top stories

Live mirror
30 storiesupdated just nowView source snapshot
  1. Does Georgism work? Five years later (astralcodexten.com)
    43comments
  2. DeepSeek Elastic Compute (DSec) (arxiv.org)
    42comments
  3. PipePipe: NewPipe hard fork implementing SponsorBlock (github.com/infinityloop1308)
    166comments
  4. Show HN: Reladraw – A diagram language where you decide where to place things (github.com/reladraw)
    52comments
  5. Evolving programming languages in the AI era (dashbit.co)
    11comments
  6. A searchable library of forgotten public-domain film clips from 1915 onward (movingimagearchive.com)
    23comments
  7. Drawgent: Coding agent on a live Excalidraw canvas (tangled.org/yanndegat.tngl.sh)
    32comments
  8. Welcome to the Medical Clinic at the Interplanetary Relay Station (lightspeedmagazine.com)
    7comments
  9. Go Concurrency Distilled (antonz.org)
    4comments
  10. Turning GLM-5.3-Flash into a Jev-like decision model (privatemode.ai)
    7comments
  11. Fifteen years later, the Apple Cards origin story (lexontech.org)
    86comments
  12. Reverse-engineering the Intel 8087's tangent algorithm: more than CORDIC (righto.com)
    3comments
  13. HomeBody: A humanoid that explores, remembers, and acts on its own (stanford.edu)
    2comments
  14. How one Twitch chat message became code execution on a streamer’s PC (scrt.ch)
    10comments
  15. Promising discoveries about the potential for life on one of Saturn’s icy moons (fu-berlin.de)
    7comments
  16. ASML says it sold 'absolutely nothing' in Europe in 2026 (tomshardware.com)
    394comments
  17. Biology might not be quantum, but its math is quantumlike (quantamagazine.org)
    3comments
  18. LA Metro has some of the slowest escalators on Earth (basin.la)
    56comments
  19. The Evolution of Vending Machines (saturdayeveningpost.com)
    1comments
  20. Things You Notice Rewatching Ed, Edd N Eddy as an Adult (noxluneworld.com)
    1comments
  21. Modern Object Pascal Introduction for Programmers (castle-engine.io)
    59comments
  22. The Lost Atomic Update on Loongson CPU (jia.je)
    6comments
  23. How I changed teaching after AI managed to do all my homework assignments (thelastsoftwareengineer.substack.com)
    132comments
  24. Generate fonts where every LLM token is the same width (mesh.host)
    6comments
  25. How to keep enjoying programming in a world of LLMs (haskell.org)
    208comments
  26. Reading’s Bayeux Tapestry (diamondgeezer.blogspot.com)
    1comments
  27. Analyzing Frontier Model Progress with My Favourite Game: Prince of Persia (blog.priyan.in)
    38comments
  28. Dutch designer made DE9: Closer to the Edit into a playable web-based instrument (creativeboom.com)
    1comments
  29. Breaking Up with Google Play: Why Conversations Is Now Free (gultsch.de)
    250comments
  30. Palantir's Co-Founder Wants Us Less Judgmental About Deadly Iran School Strike (motherjones.com)
    8comments

Show HN: Reladraw – A diagram language where you decide where to place things

170 pointsby 8h agogithub.com
51 comments
I love making diagrams to help understand, plan, etc. However, the options are (A) auto-placement languages like Mermaid or Graphviz (which don't let me decide how the diagram looks), or (B) software like Draw.io which are powerful but are very time consuming (and inefficient for agents to manipulate).

I wanted to have the benefits of both, where you can define a diagram in a diagram language, but also retain a high degree of control over what the diagram looks like.

I also wanted this to work well for humans and agents.

On the Github link, there's a playground where you can try it out without installation. There's also instructions for a simple npm install and for installing a skill you can use with Claude or other agents.

5h agoHN ↗

Thanks! The big difference is that Pikchr uses "turtle" graphics (where a cursor walks along and draws shapes). Reladraw lets you state relationships and relative positions.

So, if you have a container with children, or multiple nodes off to the right of another, with links between them, adding or resizing one adjusts the rest, without re-specifying positions the way turtle graphics would require.

5h agoHN ↗

I like it. I have too many issues with Mermaid

5h agoHN ↗

Thanks! I really like Mermaid, but if the diagram gets too complicated, it draws it how it wants and I end up reaching for Draw.io, which is also awesome, but can take a lot of time.

5h agoHN ↗

This genuinely fucks. Thank you

Fighting with mermaid is so frustraiting, especially when it comes to normal vs github formatting. This is going to replace several ad-hoc half impls I have laying around

5h agoHN ↗

Glad to hear it :) If you find that you want Reladraw to do something that it can't, let me know! I keep uncovering features by looking at actual Draw.io diagrams I've made and seeing if Reladraw can do it.

3h agoHN ↗

(since you ask...) Edges drawn with right angles would be a nice option.

2h agoHN ↗

o7 will do, and if I cook anything up I think you might appreciate I'll try and yeet over a nice PR

5h agoHN ↗

This is basically tikz's positioning library (right=of, below left=of) without having to touch LaTeX. With tikz it was never the nodes that hurt me, it was the edges. Once two edges want the same side of a box it gets ugly fast. Does the resolver do any routing, or is from:/to: all you get? And what happens with conflicting statements, does the first one win or do you get an error?

5h agoHN ↗

Appreciate the comment and questions!

Does the resolver do any routing? It doesn't auto-route around obstacles. But, if nodes A, B, and C all have edges going to the left side of D, they share that side and space themselves apart so they don't cross. If the side is too short, they'll bow out to make space for each other, so you don't have to manually fiddle. You can also give routing instructions like "these edges pass between these two nodes on their way to D".

Conflicting statements? Statements that can all hold will all apply. Right of one node and below another is okay. Or, "right of A and B and C" will clear whichever sticks out furthest. If they all can't hold, you'll get an error naming the clashing statements (e.g., something both left and right of A). Nothing silently wins.

5h agoHN ↗

nothing silently wins.

Fantastic! Never change this.

People will complain. These people also prefer type unsafe languages. Hold fast.

4h agoHN ↗

Thanks! My concern was that a resolver making decisions "to be helpful" could become surprising or frustrating.

For example, if you ask for edges to pass "between C and D", but those two nodes sit diagonally, the gap you are asking for might be the vertical channel or horizontal channel between them. So instead of guessing for you, it will tell you of the ambiguity and let you spell out what you want.

5h agoHN ↗

I was looking for something like this. I wish it had different themes, the will prob be the best improvement.

5h agoHN ↗

Great idea! So, right now it defaults to this sorta "dark" theme, and the only option you'd have is to change the diagram background color or define styles. I'll make defining some preset themes a priority!

3h agoHN ↗

Just pushed an update to add a basket of themes, including light and dark themes.

4h agoHN ↗

That is damn interesting. When I made copilot write a script that creates a .dot diagram, I found it funny that it had the same problems with placement that I have when doing it manually.

4h agoHN ↗

Thanks very much! Yea, with .dot, the layout engine decides where things go. So, the agent doesn't know what the result looks like, leading to render, look, fiddle loops. And, depending on how much you care about layout, .dot might not give you enough knobs to turn to make it look like what you want.

The idea with Reladraw is that a human or agent could just state "I want this node to the right of this other one", rather than have a layout engine decide. Hopefully less fiddling for agents!

4h agoHN ↗

I love it, and I wish it was part of Mermaid. I've always struggled with the presentation and agents tend to hack or just straight use SVG lol

4h agoHN ↗

Thanks! Mermaid is so cool, but I wanted this relative placement, too. I've played with having Claude make me infographics in HTML and also using SVG. They can be surprisingly decent, until you want something complicated, then it gets messy! I figure, let the agents just say what they want, and let the tool (Reladraw) worry about the arithmetic. No use having an agent burning tokens to recompute coordinates with dubious results! >.<'

4h agoHN ↗

I wish this just implement tikz without latex. I've yet to see a better drawing library that is both simple and has the depth to build the most complicated things.

3h agoHN ↗

tikz looks super powerful. Reladraw is opting for a narrower job - making diagrams with boxes, groups, arrows, where you can say relative positions and let Reladraw save you extra work.

4h agoHN ↗

Huh, can you read my mind?! :D

This is super cool. I love diagrams, charts, etc. and use them a lot. Both privately and for work.

Definitely going to make use of this, I didn't know how much I wanted something like this until right now hahaha.

4h agoHN ↗

Glad to hear it! I'm a big fan of diagrams for understanding, mapping out architecture, etc!

4h agoHN ↗

Seems a little buggy, I added this line:

edge parser -> renderer "test edge" from: left to: right

and it wasn't smart enough to make a curved arrow

3h agoHN ↗

Genuine bug! Good find. I'll look into a fix.

52m agoHN ↗

Bug is fixed in the playground. Thanks again for catching it!

It gave me some ideas to make routing better, too. For example, maybe you don't want the edge to curve above, but rather below. Or, in more complex examples, maybe you want the edge to curve above one thing and to the right of another.

(will update npm shortly too)

4h agoHN ↗

Mermaid works great for fixed layouts like sequence diagrams and Gantts. For flowcharts, where position is king, it's bad.

I've tried using svg in my MD files but they get unwieldy quite fast. This is a great idea. My first reaction was - but what's if I need something more exact. But reflecting on it, I've realized that this relative positioning is probably enough.

3h agoHN ↗

Yea, it's hard to beat absolute positioning if you want something ultra-custom, but I'm hoping for most flowcharts, mind maps, etc. the relative positioning is enough to get what you want without fiddling too much!

1h agoHN ↗

Agreed. Next diagram I make I’m taking a photo of a whiteboard and letting AI figure out relative positioning

3h agoHN ↗

That’s what I have been using, but from glancing through this repository, it looks like the win here is that you can define where you want things and yet still have diagram as code

3h agoHN ↗

Yep, exactly! D2 is in the same family as Mermaid, i.e., automatic layout, with some escape hatches like grid placement or absolute positioning. Reladraw sits in a gap between automatic layout and absolute positioning.

22m agoHN ↗

D2 has some support for this. You can fix the position of certain elements and then it will redraw things around it.

I’ve been thinking about something similar to this but D2 wasn’t totally open source until now.

3h agoHN ↗

Does this need to be shipped with a renderer? A better question is, are the node layout instructions ultimately being translated into absolute positions?

If so, you could target any number of render backends, keeping the same simple interface for your agent, avoiding the bazillion problems rendering engines face to work well across the ecosystem.

3h agoHN ↗

Great idea! Yep, the layout instructions are translated into absolute positions. The one gap right now is just that the CLI doesn't give you a way to say "just calculate the positions, stop there, and give me JSON". The logic basically exists to do that, with a minor tweak to the CLI to allow that.

I'll add that to my Reladraw todo list!

2h agoHN ↗

Mermaid is open source, no? Can we just add these placement constraints to Mermaid instead of making a whole new language?

2h agoHN ↗

That's a very thought-provoking question. Adding placement constraints on top of an automatic layout engine sounds like a challenging problem. You'd have the engine deciding where to place things, but you'd also be nudging things or constraining things.

This might not be what you have in mind, but Graphviz has a `rank` which can be used as a coarse way to influence the shape of the diagram. (I'm assuming you had something more sophisticated in mind though)

Probably easier would be if the relative drawing were its own distinct Mermaid diagram type, but then it would be largely a new language anyway.

2h agoHN ↗

If this were implemented in a language with fewer dependencies, it'd be great.

2h agoHN ↗

Reladraw has no runtime dependencies and Typescript is only needed to build it. If you mean Node, though, that's fair!

1h agoHN ↗

Oh wow. Let me give that a try. I was going to try bun or Deno, but your suggestion might result in much smaller binaries.

1h agoHN ↗

This seems nice but I’ll need to read the syntax more carefully to see how capable and convenient it is.

1h agoHN ↗

Definitely! Capability vs convenience is tough! Hope you find it useful.

1h agoHN ↗

This is very needed in the AI coding age! I find diagramming is one of the best ways for high bandwidth alignment between my mental model and the agent’s. I have been working on this problem a bit as I see good visuals as a key bottleneck in faster development while maintaining a real architecture.

Will def be adding this to my list of diagramming tools the agent can use!

1h agoHN ↗

It's funny, you articulated it very similar to how I feel! Seems like we need ways to maintain mental models at a high enough level of abstraction when working with agents.

There's a skill in the repo that you can install using `npx skills` to get started with. I'm sure the integration of Reladraw with agents can be made way better, though. It's just a bit... basic/rudimentary right now!

13m agoHN ↗

That's cool! I'm curious to see how it goes if you try making some super complex :)

21m agoHN ↗

1. awesome ~ this seems to be in a sweet spot! (yes, mermaid is fine; but often looks bad - esp when visualizing large diagrams)

2. it would be great to have this as a layouting layer for C4

3. which brings me to a suggestion: i think it would make sense to allow for decoupling the topological parts of the language (arrows, groupings, etc) from the layouting concerns (left of, right of, etc)