• Stars
    star
    915
  • Rank 49,917 (Top 1.0 %)
  • Language
    JavaScript
  • Created over 5 years ago
  • Updated over 5 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

๐Ÿงœโ€โ™€๏ธ RESTful rendering pipeline for generating sequence and UML diagrams using Mermaid for Markdown docs (Diagrams as a Service)

๐Ÿงœโ€โ™€๏ธ Mermrender

RESTful rendering pipeline for generating sequence and UML diagrams using Mermaid to embed in Github readmes, Markdown docs and more! Mermrender uses Mermaid.JS and Mermaid CLI under the hood.

Feel free to contribute by making a pull request!

Maintainer: [email protected]

Mermaid Credit: https://mermaidjs.github.io/

Run Mermrender in Gitpod, a free online dev environment for GitHub:

Open in Gitpod

Hit the API! (Demo)

https://3000-cebcfedc-d281-4f38-b13a-cc6312da177b.ws-us0.gitpod.io/diagram/2VxdWVuY2VEaWF

img

Setup in VSCode

Check out this awesome guide for setting up diagram rendering within VSCode: https://quintussential.com/archive/2017/12/10/Diagraming-with-Mermaid/

Motivation

Github doesn't support rendering Mermaid diagrams in their Markdown editor. Mermaid is a powerful tool that uses a well-defined schema to then interpret diagrams into an SVG. The idea of this tool is to allow embedding images dynamically via a REST endpoint to add UML/Sequence diagrams into your documentation/readmes/markdown files easily, whether the editor supports Mermaid or not.

Demo

demo

Usage

1) Generate the diagram code with Mermaid OR PlantUML

sequenceDiagram
    participant A as Alice
    participant J as John
    A->>J: Hello John, how are you?
    J->>A: Great!

or

@startuml
object Object01
object Object02
object Object03
object Object04
object Object05
object Object06
object Object07
object Object08

Object01 <|-- Object02
Object03 *-- Object04
Object05 o-- "4" Object06
Object07 .. Object08 : some labels
@enduml

You can edit and render them live on this website: https://mermaidjs.github.io/mermaid-live-editor/

2) Escape the diagram to encode it

Next, you need to run it through an escaper like the following: https://www.freeformatter.com/java-dotnet-escape.html#ad-output

3) Generate the image link to embed

Send a POST request to http://localhost:3000/encode/plantuml or http://localhost:3000/encode/mermaid depending on the type with a diagram key in the body with the above escaped diagram:

Example Body:

{
  "diagram": "sequenceDiagram\r\n    participant Alice\r\n    participant Bob\r\n    Alice->>John: Hello John, how are you?\r\n    loop Healthcheck\r\n        John->>John: Fight against hypochondria\r\n    end\r\n    Note right of John: Rational thoughts <br/>prevail...\r\n    John-->>Alice: Great!\r\n    John->>Bob: How about you?\r\n    Bob-->>John: Jolly good!"
}

This will generate a respose:

{
  "embed_link": "http://localhost:3000/diagram/2VxdWVuY2VEaWF"
}

You can embed the following embed_link by using the following syntax:

Markdown

![alt_caption](http://localhost:3000/diagram/2VxdWVuY2VEaWF)

HTML

<img src="http://localhost:3000/diagram/2VxdWVuY2VEaWF"/>

BBCode (Forums)

[img]http://localhost:3000/diagram/2VxdWVuY2VEaWF[/img]

Additional Options

Add the following optional query parameters to add custom dimensions to your images:

(Not yet implemented)

How To Run

  1. npm i to install dependencies
  2. node index.js
  3. sudo npm install -g node-plantuml
  4. sudo npm install -g mermaid.cli

or run Mermrender in Gitpod, a free online dev environment for GitHub:

Open in Gitpod

More Repositories

1

Git-Enforcer

๐Ÿ‘ฎ GitHub Bot For Validating Pull Request Mergability Requirements and Issues Structure
JavaScript
178
star
2

cloudflare-google-auth

JS module to authenticate to Google Cloud from within a Cloudflare Worker
TypeScript
24
star
3

Firecracker-VM-Wizard

๐Ÿ”ฅ Helper program for setting up a Firecracker microVM on a fresh metal
Shell
15
star
4

Cloudflare-Stream-Video-Upload

Demoing Cloudflare Stream TUS Uploads for Creator Uploads
TypeScript
15
star
5

stable-matching-algorithm

Python code for stable matching algorithm video tutorial by The Simple Engineer
Python
13
star
6

WIPCream

๐ŸฆGithub Work In Progress (WIP) Management Bot
JavaScript
12
star
7

mac-space-monitor-rs

A Rust crate for subscribing and retrieving the current active space on Mac OS X
Rust
10
star
8

simple-engineer-aws-deployment-tutorial

JavaScript
10
star
9

Hackernews-Recommender-System

ML algorithm that uses cosine similarity and TF-IDF to recommend top posts based on interests
Jupyter Notebook
8
star
10

ASU-Open-Seat-Detection

Python script to find open seats and notify via email and SMS
Python
8
star
11

cloudflare-stream-downloader

Download tool for Cloudflare Stream
Go
7
star
12

AirBnB-Dataset-Visualization-Backend

๐Ÿ”ฅ๐Ÿ”ฅ ๐Ÿก Interactive Data Visualization for the AirBnB Dataset - 2017 ๐Ÿ“‰ ๐Ÿ”ฅ๐Ÿ”ฅ
Python
6
star
13

Distributed-Prefix-Trie

Distributed prefix trie implementation to demonstrated autocomplete capabilities at a distributed level.
Java
4
star
14

Algorithms

โˆญ Trees, Graph Theory, String Manipulation, Algorithms, Riddles!
Java
4
star
15

Workers-OpenTelemetry

Providing tracing using OpenTelemetry in Cloudflare Workers
TypeScript
3
star
16

rate-limiter

Distributed rate limiter written in Go, supports token bucket algorithm
Go
3
star
17

PlayListr

iOS Application designed in Swift 2 to give users the best new music experience.
JavaScript
3
star
18

Planit

CLI book planner to hit your reading goal
JavaScript
3
star
19

Algorithms-2019-Edition

๐Ÿง Algorithms
Java
3
star
20

This_American_Life_Downloader

Download tool designed to download either a random episode of TAL or the most recent episode of TAL in an MP3 format directly to the desktop.
Python
3
star
21

Search-Algorithm-Visualizer

Visualizing search algorithms in React
JavaScript
3
star
22

ServerlessNewsletter

AWS Lambda Based Architecture for Serverless Newsletter Management
JavaScript
3
star
23

Cloudflare-R2-Concurrency

Go
2
star
24

AirBnB-Dataset-Visualization-Frontend

๐Ÿ”ฅ๐Ÿ”ฅ ๐Ÿก Interactive Data Visualization for the AirBnB Dataset - 2017 ๐Ÿ“‰ ๐Ÿ”ฅ๐Ÿ”ฅ
JavaScript
2
star
25

Memdoop

An in-memory implementation of the Hadoop file-system
Java
2
star
26

cloudflare-worker-gauth-example

Demo of my Cloudflare OAuth2 module for Cloudflare Workers
TypeScript
2
star
27

AWS-to-Cloudflare-Migration-Utility

โ˜๏ธ Utility to help transfer items from AWS S3 to Cloudflare Stream & Cloudflare R2
TypeScript
2
star
28

AsciiPhile

๐Ÿ“ Simple Scalable Object-Based Content Store
Java
2
star
29

Java-Simple-Graph

๐ŸŒณ Simple Graph/Tree Data Structure API for Java
Java
2
star
30

c-development-base

My preferred build environment for C development on ARM64/Apple Silicon
C
1
star
31

SimpleEngineerYoutube

1
star
32

react-base-template

My preferred boiler plate template for React projects
TypeScript
1
star
33

FirstFollowSetTheory

First & Follow Set Syntax Recognizer and Dynamic Calculation For User-Defined Syntax
C++
1
star
34

React-SSR-CSR

Demo test implementing server-side rendering with React, Redux and GraphQL
JavaScript
1
star
35

WhereIsMyMoney

๐Ÿ’ฐ Simplistic Budgeting Tool Focusing on the Essentials
JavaScript
1
star
36

redditplayer

JavaScript
1
star
37

personal-website

TypeScript
1
star
38

writings

My personal website
JavaScript
1
star
39

Maven-Fundamentals

The basics of the Maven Build Tool
1
star
40

Neural-Networks

Neural Network implementations for predictive learning
Python
1
star
41

spotify-alarm-mac

Simple terminal interface to set up a song to play as your alarm in the morning from Spotify
Python
1
star
42

Learn_Python_The_Hard_Way

Walk through of all the book examples
Python
1
star
43

MathInterpreter

Interprets simple mathematical expressions
Java
1
star
44

Dynamic-Markdown-Parser

Generates nested structure for generating dynamic anchor linking and table of contents for MDX type blogs/sites
JavaScript
1
star
45

JudgeMyEducator

Rate My Prof Clone
CSS
1
star
46

Rust_DNS

RFC 1035 DNS Client/Server implementation in Rust
Rust
1
star
47

r2_download_file

download file cloudflare r2
Go
1
star
48

Hack-Language-Assembler

Java
1
star
49

Resume

Ryan Schachte's LateX Resume
TeX
1
star
50

Simplex-Language

Simplex Programming Language & Interpreter
Java
1
star
51

Fibonacci_Analysis

Different methods of computing the fibonacci sequence using recursion, dynamic programming and matricies.
Python
1
star