Mermaid Converter
Author: hjlarry
Version: 0.0.1
Type: tool
Repo: https://github.com/hjlarry/dify-plugin-mermaid
Description
A Dify plugin that converts Mermaid diagram code to images in multiple formats (PNG, JPG, PDF, SVG) using the mermaid.ink API service. This plugin enables users to generate visual diagrams programmatically within Dify workflows and agent interactions.
Features
- Multiple Output Formats: Supports PNG, JPG, SVG, and PDF formats
- Theme Support: Choose from default, dark, neutral, or forest themes
- Customization Options: Configure background colors, image dimensions
- Error Handling: Graceful handling of invalid syntax and API failures
- No API Key Required: Uses the free mermaid.ink public service
Supported Parameters
Usage Examples
The converter config:
Here I create a workflow and ask the LLM to generate a git common operation mindmap by mermaid code:
The final result:
Troubleshooting
Common Issues
-
"Invalid Mermaid syntax"
- Check your Mermaid code syntax using Mermaid Live Editor
- Ensure proper line breaks and spacing in diagram code
-
"Conversion timeout"
- Simplify complex diagrams
- Check network connectivity
- Try again as the service may be temporarily slow
-
"Diagram too large"
- Reduce the complexity of your diagram
- Split large diagrams into smaller components
-
Empty or corrupted output
- Verify Mermaid syntax is correct
- Check if all required parameters are provided
- Try with a simpler diagram first
Limitations
- Maximum diagram size limited by mermaid.ink API
- Dependent on external service availability
- Some advanced Mermaid features may not be supported
- Internet connectivity required