Skip to main content

execute_transform

Function execute_transform 

Source
pub fn execute_transform(
    source: &str,
    transform_name: &str,
    extra_params: &HashMap<String, String>,
) -> Result<String, String>
Expand description

Execute a named transform on a source file with optional extra parameters

§Arguments

  • source - The source text to transform
  • transform_name - The transform to apply (e.g., “ast-tag”, “token-core-json”)
  • extra_params - Optional parameters for the transform

§Extra Parameters

  • ast-full: “true” - Show complete AST including all node properties

§Returns

The transformed output as a string, or an error message

§Examples

let source = "# Session\n\nContent";
let params = HashMap::new();

// Get tree visualization (default view)
let output = execute_transform(source, "ast-treeviz", &params)?;

// Get complete AST with all properties
let mut full_params = HashMap::new();
full_params.insert("ast-full".to_string(), "true".to_string());
let output = execute_transform(source, "ast-tag", &full_params)?;