colander_data_converter.exporters.mermaid
- class colander_data_converter.exporters.mermaid.MermaidExporter(feed, theme=None)[source]
Bases:
BaseExporter
Exporter class for generating Mermaid diagrams from Colander feed data.
This exporter uses Jinja2 templates to transform Colander feed data into Mermaid diagram syntax. It supports custom themes and falls back to a default theme if none is provided.
- __init__(feed, theme=None)[source]
Initialize the Mermaid exporter.
- Parameters:
feed (
ColanderFeed
) – The Colander feed data to be exportedtheme (
dict
, optional) – Custom theme configuration. If None, loads the default theme automatically
- export(output, **kwargs)[source]
Export the Colander feed data as a Mermaid diagram.
Uses the configured template and theme to generate Mermaid diagram syntax and writes it to the provided output stream. It does not render the diagram.
- Parameters:
output (
TextIO
) – The output stream to write the Mermaid diagram to**kwargs – Additional keyword arguments passed to the template engine
- load_default_theme()[source]
Load the default theme configuration from the package resources.
Reads the default theme JSON file from the package’s data/themes directory and loads it into the theme attribute. This method is automatically called during initialization if no custom theme is provided.
- Raises:
FileNotFoundError – If the default theme file cannot be found
json.JSONDecodeError – If the theme file contains invalid JSON