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).
Examples
typst_code <- c("= Hello World", "This is a Typst document.")
is_valid_typst(typst_code) # TRUE
#> [1] TRUE
typst_code <- c("= Hello World", "#This is a Typst document.")
is_valid_typst(typst_code) # FALSE
#> [1] FALSE
if (FALSE) { # \dontrun{
typst_code <- c("= Hello World", "#This is a Typst document.")
is_valid_typst(typst_code, error_on_failure = TRUE) # ERROR
} # }