You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I tried to include a video in my typst presentation (based on the polylux package). I found out that this isn't supported (yet?) in #955.
So I tried to settle for a link to the local file instead but I couldn't get it to work. In the output pdf, there is no link
#link("https://www.google.de")[This works]
#link("file://demo.mp4")[This does not work]
#link("file:///demo.mp4")[This does not work]
#link("./demo.mp4")[This does not work]
Use Case
I want to quickly open a local file from the generated pdf. For instance, when creating a presentation and I want to show a video or demonstrate something, I want to have a clickable link in the pdf that opens the linked file with the default program for its type, e.g. video player for video, folder explorer for folders.
Reacted by Victor L., Rafael Villar Burke (Pachi), Marco Bulgarelli and makeworld
This feature would be awesome on its own, but even more so in conjunction with HTML export, in particular for Typst's integration into note-taking apps #114 (comment) which rely heavily on internal/local links to create a network of notes. But then it would be preferable not to achieve such links using embedding/self-contained attachments to avoid overly redundant data storage and exponential file sizes.
If it is possible to implement local links this way, I find that
#link("./filename.ext")[...]
feels more "natural" on the scale of user-friendliness and makes it easier to specify both absolute (filename.ext) and relative (./filename.ext) paths.
Interesting that it just works. Typst just forwards the link to the PDF reader, so I guess PDF supports this. It might not have the exact same semantics as paths in Typst, e.g. with absolute paths.
Now I tried something new. In the previous code, the entire block (including the caption) was clickable. It is more desirable that only the image was clickable.
Closing this as it turns out that this already works. Not sure what I did wrong when I tried the first time.
The behavior depends on the pdf viewer I use.
For okular all of the following work and seem to open with the default program I configured for the given file type (e.g. VLC for videos, dolphin as file manager, gwenview for images). For pdfpc, the video and image also opens but uses some other programs (e.g. mkv for the video) and the folder fails to open for me.
Activity
bastienvoirin commentedon Nov 16, 2023
This feature would be awesome on its own, but even more so in conjunction with HTML export, in particular for Typst's integration into note-taking apps #114 (comment) which rely heavily on internal/local links to create a network of notes. But then it would be preferable not to achieve such links using embedding/self-contained attachments to avoid overly redundant data storage and exponential file sizes.
If it is possible to implement local links this way, I find that
feels more "natural" on the scale of user-friendliness and makes it easier to specify both absolute (
filename.ext) and relative (./filename.ext) paths.Atreyu-94 commentedon Nov 21, 2023
@bastienvoirin Great! I got it with your syntax, this really saves a lot of time! I didn't think it was included.
Should this issue be closed?
Atreyu-94 commentedon Nov 21, 2023
I attempted to nest the image within the link, so that the image was the clickable element. It worked flawlessly and was also quite intuitive.
well, this made me very happy :P
Edit: Grammar :(
laurmaedje commentedon Nov 21, 2023
Interesting that it just works. Typst just forwards the link to the PDF reader, so I guess PDF supports this. It might not have the exact same semantics as paths in Typst, e.g. with absolute paths.
Atreyu-94 commentedon Nov 21, 2023
Now I tried something new. In the previous code, the entire block (including the caption) was clickable. It is more desirable that only the image was clickable.
However, this time it did not work, perhaps because the link content does not support images.
So I only get instead of the image, the text corresponding to the command and it is effectively clickable:

Atreyu-94 commentedon Nov 21, 2023
Ok, I got it adding
#image(...)instead ofimage(...), sorry :Pede1998 commentedon Dec 1, 2023
Closing this as it turns out that this already works. Not sure what I did wrong when I tried the first time.
The behavior depends on the pdf viewer I use.
For
okularall of the following work and seem to open with the default program I configured for the given file type (e.g. VLC for videos, dolphin as file manager, gwenview for images). Forpdfpc, the video and image also opens but uses some other programs (e.g. mkv for the video) and the folder fails to open for me.This does not work it seems as the pdf viewer does not expand the tilde.