Parsing metadata for typst through a loop in show.typ #11759
-
DescriptionI have created a custom typst template to convert a qmd to pdf and it fails when running
Here are the files: index.qmd (Empty values and missing values for testing purposes)
typst-template.typ
typst-show.typ (This is likely the one with issues) I am following the example here, but I can't understand how it works. For example; where does the
I can see in the generated
The typst code has been validated on the typst app, so it's known to work. There is something going wrong in the show.typ file. There are probably other issues as well. Here is a repo with these files organized as a quarto extension: https://github.com/royfrancis/typst-loop-test
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Indeed Typst does have a learning curve. The error you are seeing is because your
Typst is going to pass the rest of the document as an implicit second parameter.
So you can either add a
Secondly, you seem to be using a metadata key ( For example, renaming the key to typst-show.typ
index.qmd
![]()
|
Beta Was this translation helpful? Give feedback.
Indeed Typst does have a learning curve.
The error you are seeing is because your
sheet()
function only takes on parameterlabels
, but when used withTypst is going to pass the rest of the document as an implicit second parameter.
.with()
partially specifies the parameters, returning another function with those parameters bound.#show:
will pass the rest of the document to the function on the right of the colon.So you can either add a
doc
parameter to yoursheet()
function, or you can explicitly ignore this content withSecondly, you seem to be using a metadata key (
labels
) which is defined by Quarto or Pandoc. You can see this by…