Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Export diagram as image #87

Open
thunderbolt-fire opened this issue Nov 25, 2024 · 2 comments
Open

Export diagram as image #87

thunderbolt-fire opened this issue Nov 25, 2024 · 2 comments
Labels
enhancement New feature or request

Comments

@thunderbolt-fire
Copy link

No description provided.

@joshspicer
Copy link
Member

joshspicer commented Dec 2, 2024

There is no button to directly export as a png. By clicking the little markdown button you can get the "source code" for the mermaid diagram and paste directly into places where mermaid can be rendered (like this GitHub issue)

For example, I copied this directly out of VS Code, generated by the extension:

classDiagram
    class Main {
        +main(String[] args)
    }

    class Animal {
        <<interface>>
        +makeSound()
    }

    class Dog {
        +makeSound()
        +eat()
    }

    class Cat {
        +makeSound()
        +eat()
    }

    class AbstractAnimal {
        -String name
        -int age
        +AbstractAnimal(String name, int age)
        +getName()
        +getAge()
        +eat()
    }

    class AnimalFactory {
        +createAnimal(String type, String name, int age)
    }

    class Zoo {
        -List<Animal> animals
        +Zoo()
        +addAnimal(Animal animal)
        +makeAllSounds()
        +feedAllAnimals()
    }

    Main --> Animal
    Dog --> Animal
    Cat --> Animal
    Dog --> AbstractAnimal
    Cat --> AbstractAnimal
    AnimalFactory --> Animal
    Zoo --> Animal
Loading

You can of course also screenshot your diagrams with your app of choice :)

I agree a button would be handy, it was suprisingly a bit technically challenging so we left it out of the initial version. I've added the feature-request label

@joshspicer joshspicer added enhancement New feature or request and removed feature-request labels Dec 2, 2024
@joshspicer joshspicer changed the title How do I export the diagram as a img? Export diagram as image Dec 16, 2024
@rudy750
Copy link

rudy750 commented Feb 14, 2025

Can we also export to PDF etc..
Similar to how Markdown Preview Mermaid Support does it

Image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants