Ok so here is the connect() function that I made and that does what I want. This function connects 2 nodes, node_a and node_b, by an arrow that follows the line between the 2 node centers, but that just touches the edges of the 2 nodes.
#let connect(node_a, node_b) = {
import draw: *
let name_a = node_a.at(0).name
let name_b = node_b.at(0).name
let name_intersections_set = name_a + "-" + name_b + "--intersections"
intersections(name: name_intersections_set, {
node_a
node_b
line(name_a, name_b, stroke: none)
})
line(name_intersections + ".0", name_intersections + ".1", mark: (end: ">"))
}
Example:
#let test = canvas({
import draw: *
let a = content((0, 0), [Das ist\ ein Text!], frame: "circle", name: "a")
let b = content((3, 2), [Hallo!], frame: "circle", name: "b")
connect(a, b)
})