-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Description
Description
Inkscape supports to "link" images in SVG files by setting the xlink:href attribute of <image> to a path relative to the SVG file. Currently, Typst only supports base64 encoded embedded images instead.
Linking to images is very useful as it avoids duplication of binary data in a project (the original image file and the embedded data in the SVG) and it also allows the user to quickly switch/replace the image file without having to open the SVG editor again to replace the embedded image.
On Discord, @LaurenzV raised the concern that this "could allow breaking out of the "sandbox" provided by Typst" and added "I guess you could check whether the given path is still within the root and support that".
I don't know much about how SVGs are currently handled but shouldn't it be possible to do something similar to how the paths of the built-in image function are handled? I don't see why this makes a difference for the security model of Typst.
Use Case
This feature would be useful for users wanting to include SVGs containing images created by Inkscape (and maybe other tools?) by avoiding duplication of binary data and avoiding having to manually update the SVG whenever one of the source images changes. In general, images inside of SVGs can be very useful for figures that place some annotations on top of images, use an image as part of a larger technical figure, or, for "collages" of images which can be nicely arranged in Inkscape without having to manually "code" coordinates in Typst.