is_valid_typst: Is valid Typst?

View source: R/is_valid.R

is_valid_typstR Documentation

Is valid Typst?

Description

Check that a character vector is valid Typst markup by compiling it. If no error, it assumes the code is valid.

Usage

is_valid_typst(x, error_on_failure = FALSE)

Arguments

x

A character vector

error_on_failure

Whether to raise an error if the code is invalid. Default to FALSE.

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

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)


tynding documentation built on March 31, 2026, 5:06 p.m.