diagraph icon indicating copy to clipboard operation
diagraph copied to clipboard

size of nodes does not adjust when using HTML labels

Open gwennlbh opened this issue 9 months ago • 3 comments

hiya! thanks for the package, it's really useful!

i wanted to add colored subtext to my nodes and used the html-like label=<html here> syntax

unfortunately, it seems like the node's width is not properly calculated when using html-mode labels?

repro:

#import "@preview/diagraph:0.3.2"
#show raw.where(lang: "dot"): it => diagraph.render(it.text)

// (the backslash is for github markdown)

```dot
digraph {
  a[label=<A test right here>]
  a -> "a test right here"
}
```

Edotor output:

Typst render:

Image

real life example:

Image

gwennlbh avatar Mar 23 '25 14:03 gwennlbh

I need to figure out why, but on my machine it works like expected while it doesn't on Typst Universe.

Btw: You can use four ` symbols to include code blocks in your code blocks:


Hello
```c
int a = 0;
```

Robotechnic avatar Mar 26 '25 12:03 Robotechnic

I figured it out and, for now, the answer is: Use a holder version of typst where the SVG text is not converted by typst.

Robotechnic avatar Mar 26 '25 12:03 Robotechnic

I added html parsing so it should work with the last version (0.3.5). It doesn't support tables for now. It is still a work in progress so there might be rendering issues. At least it works as expected the examples you gave.

Robotechnic avatar Jul 03 '25 13:07 Robotechnic