API reference
python:astx:astx.viz
module viz
astx.viz
Source: packages/astx/src/astx/viz.py:1
AST graphic representation Module.
This module provides utilities for converting an Abstract Syntax Tree (AST) to Mermaid for inline display in Jupyter (Lab ≥4.1 / NB ≥7.1) and to ASCII via the mermaid-ascii CLI.
Functions
-
_esc_mermaid_label — Escape quotes for Mermaid labels (image/Jupyter path).
-
_find_mermaid_ascii — Resolve the `mermaid-ascii` CLI path or return None.
-
_stable_id — Build a stable-ish node id from label/ref/content.
-
_traverse_ast_to_mermaid — Convert AST to Mermaid.
-
ast_to_mermaid — Mermaid for Jupyter/image (uses named items).
-
ast_to_mermaid_ascii — Mermaid tailored for mermaid-ascii, no named items, pipe edge labels.
-
visualize_ascii — Render the AST to ASCII using the `mermaid-ascii` CLI.
-
visualize_image — Display the AST as Mermaid inline in Jupyter (Lab ≥4.1 / NB ≥7.1).