A Telegram bot for rendering Mermaid diagrams in inline mode. Similar to InLaTeXbot but for Mermaid diagrams.
- Type
@inmermaidbot
followed by your Mermaid diagram code in any chat - The bot validates the syntax and shows the result
- Select the result to share the diagram code
- For the actual image, send the code to the bot in direct messages
- Start a chat with the bot
- Send your Mermaid diagram code
- Receive a PNG image
- Python 3.8+
- Telegram Bot Token (get from @BotFather)
-
Clone the repository
git clone https://github.com/yourusername/inmermaid-bot.git cd inmermaid-bot
-
Install dependencies
pip install -r requirements.txt
-
Install Playwright browser
python -m playwright install chromium
-
Set up environment variables
Create a
.env
file:BOT_TOKEN=your_telegram_bot_token_here
-
Run the bot
python bot.py
-
Build the image
docker build -t inmermaid-bot .
-
Run the container
docker run -e BOT_TOKEN=your_token_here inmermaid-bot
- Flowchart - Flow diagrams and flowcharts
- Sequence Diagram - Sequence diagrams for interactions
- Class Diagram - UML class diagrams
- State Diagram - State transition diagrams
- Entity Relationship Diagram - Database ER diagrams
- User Journey - User journey maps
- Gantt Chart - Project timeline charts
- Pie Chart - Pie and donut charts
- Quadrant Chart - Four-quadrant analysis
- Timeline - Timeline diagrams
- Mindmap - Mind mapping diagrams
- And many more!
graph TD
A[Start] --> B{Decision}
B -->|Yes| C[Action 1]
B -->|No| D[Action 2]
C --> E[End]
D --> E
sequenceDiagram
participant Alice
participant Bob
Alice->>Bob: Hello Bob!
Bob-->>Alice: Hello Alice!
Alice->>Bob: How are you?
Bob-->>Alice: I'm good, thanks!
classDiagram
Animal <|-- Duck
Animal <|-- Fish
Animal : +int age
Animal : +String gender
Animal: +isMammal()
class Duck{
+String beakColor
+swim()
+quack()
}