render_scheme
Render chemical reaction schemes to publication-ready CDXML from YAML, compact text, or reaction JSON. Output as CDXML string or file.
Instructions
Render a chemical reaction scheme to publication-ready CDXML.
Accepts exactly ONE of: yaml_text, compact_text, or json_path. Call with NO arguments to see the full YAML schema reference.
yaml_text: Write YAML with structures (ID + SMILES) and steps (substrates, products, above/below arrow).
json_path: Path to reaction JSON from parse_reaction (auto-layout).
IMPORTANT: Every SMILES in the YAML must come from a tool — resolve_name, modify_molecule, parse_reaction, extract_structures_from_image, etc. Never write SMILES from built-in chemistry knowledge or from reading an image with vision. Always call the appropriate tool first, then use the SMILES from its output in your YAML.
Convention: ONE substrate on center line per step. Additional reagents go in above_arrow (structures or text). This shares intermediates between sequential steps.
Args: yaml_text: YAML scheme descriptor string. compact_text: Compact DSL syntax string. json_path: Path to a reaction JSON file. layout: Layout for json_path: "auto", "landscape", "portrait". output_path: If given, write the CDXML to this file and return {ok, output_path, size} instead of the raw CDXML string.
Returns: CDXML string (when output_path is None), or {ok, output_path, size} when output_path is provided, or YAML schema reference if called with no arguments.
Safety override: Render a scheme through a validated no-overwrite staging file.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| layout | No | auto | |
| json_path | No | ||
| yaml_text | No | ||
| output_path | No | ||
| compact_text | No |