Open ntjess opened 9 months ago
I just confirm this. This is because the target of the link is ./path/to/file
, so the browser jumps to 127.0.0.1:some_port/path/to/file
. And we jump to /
for all unknown path, so another preview tab is opened. https://github.com/Enter-tainer/typst-preview/blob/eb88f6056d9212f209e1b799c5ea456aee7b2811/src/main.rs#L46
But i think this can be hard to fix. And links in official typst-cli's svg is not clickable.
The webview is likely to never have access to the filesystem, because the browser disallows you to do that. We can forward file resources with authorization from preview server, tho.
It may still beyond the design of typst, which is probably broken by future typst. Regard to that, should we discuss it in scope of typst instead of in scope of typst-preview?
To avoid webview indirectly accessing to filesystem, you can embed the video by reading content by read
first.
#let video = read("./video.mp4");
#let svg-to-embed = embed-video(video);
A note to future readers, you will need to specify encoding: none
and ensure the video is very short. Even a 1MB will cause the extension to hang for a long time (at least in my case)
Describe the bug
#link("./path/to/file")[text]
should provide a hyperlink to a local resource. This works in PDF and SVG outputs. However, slide mode previews just open a new copy of the slide deck instead of the linked resourceTo Reproduce