tinymist_std::typst::foundations

Function eval

pub fn eval(
    engine: &mut Engine<'_>,
    source: Spanned<String>,
    mode: EvalMode,
    scope: Dict,
) -> Result<Value, EcoVec<SourceDiagnostic>>
Expand description

Evaluates a string as Typst code.

This function should only be used as a last resort.

ยงExample

#eval("1 + 1") \
#eval("(1, 2, 3, 4)").len() \
#eval("*Markup!*", mode: "markup") \