Code Monkey home page Code Monkey logo

vscode-mermaid-editor's Introduction

Mermaid Editor

Version Installs Ratings

Mermaid Editor is vscode extension inspired by official mermaid live editor to provide the following features:

  • Live edit .mmd file with mermaid.js diagram
  • Generate image file from .mmd file with preferred format (png, jpg, webp and svg).

Usage

The extension is activated when opening .mmd file.

Open live preview

  • Select Mermaid:Preview mermaid from context menu or command palette
  • Click Mermaid:Preview diagram icon at right corner
  • ctrl+alt+[ on .mmd file

Generate image

Generate command is only available when .mmd file is opened and live preview is activated.

  • Select Mermaid:Generate image from context menu or command palette
  • Click Mermaid:Generate image icon
  • ctrl+alt+] on .mmd file

Change scale of live preview

Zoom in/out is supported for live preview.

  • Select Mermaid:Zoom in, Mermaid:Zoom out, Mermaid:Reset zoom, Mermaid:Zoom to specific scale from command palette
  • Click Mermaid:Zoom in, Mermaid:Zoom out icon focusing live preview panel
  • Zoom out: ctrl+alt+-
  • Zoom in: ctrl+alt+=
  • Reset zoom: ctrl+alt+0

Attributes

This extension supports attribute to specify preferred configuration for each .mmd file. The attribute have to be described in comment of mermaid syntax.

@config{path_to_config}

Each .mmd file can be associated with mermaid configuration. With this attribute, .mmd file can read specified configuration. path_to_config have to be described as relative path to the config json file from associated .mmd file. If this attribute is not provided, default config file setting up in mermaid-editor.preview.defaultMermaidConfig is applied.

sequenceDiagram
%% @config{./path/to/config.json}
    Alice->>John: Hello John, how are you?

@backgroundColor{color}

Each .mmd file can be associated with preferred background color. With this attribute, .mmd can read specifed background color with CSS style property format.If this attribute is not provided, default background color setting up in mermaid-editor.preview.backgroundColor is applied. The followings are example.

sequenceDiagram
%% @backgroundColor{red}
    Alice->>John: Hello John, how are you?
sequenceDiagram
%% @backgroundColor{#ff0000}
    Alice->>John: Hello John, how are you?
sequenceDiagram
%% @backgroundColor{rgb(255, 0, 0)}
    Alice->>John: Hello John, how are you?

Configuration

Settings for look & feel in preview or image generator.

Setting Default Description
mermaid-editor.preview.defaultMermaidConfig relative path to the default configuration json file for mermaidjs.
mermaid-editor.preview.backgroundColor white default background color for live preview and generated image
mermaid-editor.generate.type svg output image file type [svg, png, jpg, webp]
mermaid-editor.generate.outputPath relative path to the output target directory from project root
mermaid-editor.generate.useCurrentPath true use relative output path as same as target mmd file instead of 'outputPath'
mermaid-editor.generate.width 800 width of the output image
mermaid-editor.generate.height 600 height of the output image

Credits

This extension uses Feather icon set under CC BY 3.0

vscode-mermaid-editor's People

Contributors

tomoyukim avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.