Hi everyone, love typst and i love what it tries to do.
my question is about the text function. from my limited understanding most function have normal named parameters e.g size and positional parameters that require no name. what i can’t seem to wrap my head around is what’s the difference between body and str parameters?
#text("hello typst")
this would work just fine and i assume that the string maps to the positional str parameter. however if i type:
#text(body:["text"])
i get an error.
i like to be explicit when i write a function and i can’t understand the purpose of the body parameter or how to use it ( i see that it defaults to ).
btw, in the documentation body isn’t mentioned as position unlike str. but it say it is in the web app. see the figures bellow:
Thanks @maucejo. I understand that a content block allows for typst markup. I can see that the string positional argument is mandatory from the docs. can we combine them both? i tried and it fails. my rational is since they are both mentioned in the documentation we could use them both. Also, it seems from the webapp that body is positional parameter but the documentation doesn’t say that.
The body parameter simply leaks from the internal rust implementation. There is no named body parameter, there is just one positional parameter that accepts string and content.
Maybe they are mutually exclusive and text is used if the given content is str type and body is used for anything of type content. If that’s true then the documentation should make that clear or make body accept both types and remove text
Issue 2 - Is the body parameter positional?
Again, the documentation and web app disagree.