CoolFace
Apppublic

kaora-1/mermaid-svg-gen

sourceHugging Faceupdated 8mo agoView on Hugging Face
0likes
App README

Mermaid to SVG App

This application converts Mermaid.js code into high-quality SVG files using a headless browser (Playwright). This ensures that the generated SVG is exactly what you would see in a browser, with proper text rendering compatible with PowerPoint.

Prerequisites

How to Run

  1. 1.Build the Docker image:
bash
   docker build -t mermaid-svg-app .
  1. 1.Run the container:
bash
   docker run -p 8000:8000 mermaid-svg-app
  1. 1.Access the application: Open your web browser and go to http://localhost:8000.

Run Locally (without Docker)

If you prefer to run it directly with Python:

  1. 1.Create a virtual environment:
bash
    python -m venv venv
    .\venv\Scripts\Activate
  1. 1.Install dependencies:
bash
    pip install -r requirements.txt
    playwright install chromium
  1. 1.Run the server:
bash
    uvicorn main:app --reload

Usage

  1. 1.Paste your Mermaid code into the text area.
  2. 2.Click "Generate SVG".
  3. 3.Save the downloaded diagram.svg.
  4. 4.Drag and drop the SVG into PowerPoint.
  5. 5.Right-click the image in PowerPoint and select "Convert to Shape" (optional, for maximum editability), or just keep it as an SVG.