How do I include images and use relative paths in a Typst Quarto extension? #12638
-
DescriptionHi, I have been playing around with developing a Quarto extension that provides a Typst template to format PDF reports (https://github.com/oncology-outcomes/report) Within the When I try to render the The directory structure for the extension changes from |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 25 replies
-
|
You can't.
|
Beta Was this translation helpful? Give feedback.
-
|
Thanks for the quick response, @mcanouil,
|
Beta Was this translation helpful? Give feedback.
-
|
To my understanding, what we have done is the following
This is what we tried to explain at https://quarto.org/docs/extensions/formats.html#format-resources Using a path relative to the Hope it helps understand our current logic. |
Beta Was this translation helpful? Give feedback.
-
|
+1 on this issue. I'm developing a Typst-based extension with custom fonts (licensed for our internal company use) and ran into the same problem with asset paths. Specifically, everything works fine in 'local' development mode. But testing in a different directory after adding my extension template with I've tried using However, the equivalent interactive preview ( Honestly, I have no idea why command-line rendering would work, but interactive preview doesn't. If anyone has suggestions for making font paths work consistently across both rendering modes, that would be much appreciated! P.S. My extensions structure looks as follows: and my title: MyTemplate
author: Your Name
version: 0.1.0
quarto-required: ">=1.7.29"
format-resources:
- assets/fonts/CustomFont/*.ttf
contributes:
formats:
typst:
template-partials:
- typst-template.typ
- typst-show.typ
font-paths:
- assets/fonts/CustomFont |
Beta Was this translation helpful? Give feedback.
What happens is:
In pandoc, YAML metadata are considered Mardown to be parsed. And Pandoc Typst writer will escape the
_to\_By using raw inline, this would avoid in this markdown to typst conversion. But using raw inline in YAML field has some consequence.
Now that I remember how pandoc's work in detail, to avoid the Markdown reader applying to metadata, when a var…