Check that a character vector is valid Typst markup by compiling it. If no error, it assumes the code is valid.
Value
Indicates whether the output PDF file exists
(for example, if TRUE, then Typst has been compiled
successfully).
Note
It requires to have the Typst compiler installed. See typst.app/open-source/.
Examples
if (FALSE) { # \dontrun{
typst_code <- c("= Hello World", "This is a Typst document.")
is_valid_typst(typst_code) # TRUE
typst_code <- c("= Hello World", "#This is a Typst document.")
is_valid_typst(typst_code) # FALSE
typst_code <- c("= Hello World", "#This is a Typst document.")
is_valid_typst(typst_code, error_on_failure = TRUE) # ERROR
} # }