d2-docs
d2-docs copied to clipboard
distinguish that imports are not includes
but maybe we should add an @includes
this works:
z
layers: {
y: {
_.z.style.opacity: 0.1
}
}
but if you split out y
into its own file, it wouldn't. this could be a use case for includes
Yea perhaps it should and this should be considered a bug.
@nhooyr i don't think so. they're different things.
y.d2
a -> b: hi
(a -> b)[0].style.opacity: 0.1
x.d2
a -> b: hello
...@import y
// vs
/// @includes y
I don't follow. Why couldn't we just make imports have the same behaviour the same as includes? Why have another way to add a file? The idea after all is you can move any code anywhere into a new file and it'll just work.
@nhooyr In my example, if you "import y", it imports an opacity 0.1 connection. if you "includes y", it imports a connection but makes the existing connection 0.1 opacity.
So they're two different things. And I can see both being useful.
maybe @includes
can also take in non-d2 files!
e.g. someone wants to embed a code snippet or markdown that's in its own file.
although we don't have syntax to specify language tag and value separately. maybe we should