Search Icon, Magnifying Glass

Marmanold.com

Graduation Cap Heart Question Mark Magnifying Glass

Mermaid CLI via Whalebrew

As I noted in my quick review, I love Whalebrew. Whalebrew has allowed me to use several tools I was too afraid of before in my day-to-day workflow. The biggest of these tools is Mermaid.

I’ve been using Mermaid for years to make quick and simple Gantt charts and other diagrams. Up to now, however, my workflow has involved saving my Mermaid file in a text document and copying and pasting the text into the online Mermaid generator when I need a new image.

Not any more. Using Whalebrew and my handy Mermaid Docker image, I have Mermaid available at all times from the macOS terminal.

I have my Whalebrew package up in my GitHub repo. Give it a look if you’re interested. Below, I’ve provided some quick overview of the steps I took to get Mermaid running in Whalebrew.


Create the Dockerfile

FROM ubuntu
RUN apt-get update && apt-get install -y build-essential curl apt-utils
RUN ["/bin/bash", "-c", "curl -sL https://deb.nodesource.com/setup_8.x | /bin/bash -"]
RUN apt-get update && apt-get install -y nodejs
RUN apt-get install -y phantomjs
RUN npm install -g mermaid
LABEL io.whalebrew.name 'mermaid'
ENV QT_QPA_PLATFORM=offscreen
ENTRYPOINT ["/usr/bin/mermaid"]

Build the Dockerfile

docker build -t whalebrew/mermaid .

Install via Whalebrew

whalebrew install whalebrew/mermaid

Mermaid Away!

mermaid cool_gannt_chart.mdd --svg