I’m trying to generate a figure that illustrates call paths in a complex piece of code. The way I imagined doing this, was using fletcher nodes containing code snippets (using raw text blocks, e.g. c ....
) with relevant information - such as function calls. The call graph would then be represented with arrows between such nodes.
For instance:
#import "@preview/fletcher:0.5.3" as fletcher: diagram, node, edge
#import "@preview/codelst:2.0.2": sourcecode
#diagram(node-stroke: 1pt, edge-stroke:1pt, node-shape: rect,
{
node(sourcecode[```c
void caller() {
call_foo();
...
}
```])
edge("-|>")
node(sourcecode[```c
void call_foo() {
...
}
```])
})
Unfortunately the fletcher nodes render as if the code block has a very narrow width and the node outline doesn’t actually include its content.
I tried something similar with codly with similar results.
So now for the questions:
- am I doing something obviously wrong?
- should I be using an entirely different approach? (I’m actually trying to convert diagrams made with a combination of d2 and plantuml)
Thanks for any pointers!