| is_valid_typst | R Documentation |
Check that a character vector is valid Typst markup by compiling it. If no error, it assumes the code is valid.
is_valid_typst(x, error_on_failure = FALSE)
x |
A character vector |
error_on_failure |
Whether to raise an error if
the code is invalid. Default to |
Indicates whether the output PDF file exists
(for example, if TRUE, then Typst has been compiled
successfully).
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
## Not run:
typst_code <- c("= Hello World", "#This is a Typst document.")
is_valid_typst(typst_code, error_on_failure = TRUE) # ERROR
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.