For a fairly long time, I have been looking for a simple markdown type of solution to be able to quickly draw Gantt charts but never came across what one would call a quick option. It has always been an involved process.
To my simplistic mind, a simple solution would just be an option where I can type the action, a start date and an end date for the action line after line and it get's displayed in the Gantt chart.
The latest edition of Linux Format (Issue 221, Page 52) had mermaid as one of the hotpicks and highlighted the availability of Gantt charts which piqued my interest, I tried the solution and it is indeed what I was looking for. There are a few rough edges but it is a working solution and in normal circumstances will save considerable time and hence will become my tool of choice.
There are few ways of using it and because it has been made to work with MarkDown syntax, it can work on a number of tools too. I found CuteMarkEd to be the easiest one to use but the various ways to use it are listed below.
CuteMarkEd is not available in debian repositories nor does it have a binary for debian. Although it does have an rpm binary. As I have been playing with Debian / Ubuntu based Elementary OS lately, instead of my regular Fedora install, I figured might as well compile from source code. Steps are as below and are also available on the github page for CuteMarkEd
#Prepare the environment for building from source code.sudoapt-getinstallbuild-essentialcheckinstallgit
#Get the code from githubgitclone--recursivehttps://github.com/cloose/CuteMarkEd.git
#Install dependencies for CuteMarkEdsudoapt-getinstalllibqt5webkit5-devqttools5-dev-toolsqt5-defaultdiscountlibmarkdown2-devlibhunspell-dev
#Compile and install CuteMarkEdqmakeCuteMarkEd.pro
cdCuteMarkEd/
qmakeCuteMarkEd.pro
make
echo'A Qt-based Markdown editor with live HTML preview and syntax highlighting of markdown document.'>description-pak
sudocheckinstall--requires'libqt5webkit5, libmarkdown2, libhunspell-1.3-0, discount'sudoln-s/usr/lib/x86_64-linux-gnu/qt5/bin/cutemarked/usr/local/bin/
sudomkdir-p/usr/local/share/icons
sudocpapp/icons/scalable/cutemarked.svg/usr/local/share/icons/cutemarked.svg
sudoapt-getinstallfcitx-libs-qt5
Now there is a bug in the tool which makes the Gantt charts appear as monochrome but fear not for there is a workaround for it. Once installed, open CuteMarkEd and add a snippet in the tool to ensure Gantt charts display properly. Steps below:
Enable diagram support by clicking Extras->Options->Diagram Support
Add the snippet for quick creation by clicking Extras->Options->Snippets->Add
Then type ~~~gantt and in description something to the effect of Adds the codeblock for mermaid with the necessary javascript
Now in the snippet box add the following code.
To invoke the snippet simply type in editor ~~~gantt followed by pressing the Ctrl+Space keys.
~~~mermaidganttdateFormatYYYY-MM-DDtitle<Nameoftheproject>%%<NameofActivity>:critifcriticalelseempty,done,activeorempty,referencenameorempty,StartDateordependency,EndDateorDurationsectionPhase1NameActivity1:done,des1,2017-01-06,2017-01-08Activity2:active,des2,2017-01-09,2017-01-12Activity3:des3,2017-01-12,5dActivity4:des4,afterdes3,5dsectionPhase2NameActivity5:crit,done,2017-01-06,24hActivity6:crit,done,afterdes1,2dActivity7:crit,active,3dActivity8:crit,5dActivity9:2dActivity10:1dsectionPhase3NameActivity11:active,a1,afterdes1,3dActivity12:aftera1,20hActivity13:doc1,aftera1,48hsectionPhase4NameActivity12:afterdoc1,3dActivity15:20hActivity16:48h~~~<script>mermaid.ganttConfig={titleTopMargin:25,barHeight:20,barGap:4,topPadding:50,sidePadding:100,gridLineStartPadding:35,fontSize:11,numberSectionStyles:3,axisFormatter:[// Within a day['%I:%M',function(d){returnd.getHours();}],// Monday a week['w. %U',function(d){returnd.getDay()==1;}],// Day within a week (not monday)['%a %d',function(d){returnd.getDay()&&d.getDate()!=1;}],// within a month['%b %d',function(d){returnd.getDate()!=1;}],// Month['%m-%y',function(d){returnd.getMonth();}]]};</script>
This will then show in the preview pane following Gantt Chart and we can edit, add and modify the data as per the requirements:
Tip
You can make as many snippets as you want and for the simple solution that I mentioned right at the top, I made one snippet called dategantt replacing the code between line 3 to line 29 of the snippet above
Once done, just type dategantt followed by Ctrl+Space and you will have the framework to enter activities, start dates and end dates. Gantt Chart will be ready.
One of the drawbacks of the CuteMarkEd is that the pdf export there just does not work and you will need to rely on a screenshot. Now if the Gantt chart is really huge a screen shot wont cut it and mermaid does offer the ability to generate svg file for your effort. It is ofcourse a command line tool but is actually fairly easy to use once installed.
#check if nodejs is installed. If command below results in nothing then you need to install nodejsnodejs-v
## Instal nodejssudoaptinstallnodejs
#On Ubuntu there is some link issue where node is #referenced as nodejs which results in issues #while installing npm modules. This can be avoided #by creating a symlink using following command.sudoln-s/usr/bin/nodejs/usr/bin/node
#Install npmsudoaptinstallnpm
#In order to install npm modules without sudo,#As explained in one of my previous post:# http://mgw.dumatics.com/ghost-on-fedora-24/#step3installnpmmodules, #it requires fixing the permissions using following steps.#This needs to be done only once so if you have #done this in past, then there is no need to repeat.mkdir~/.npm-global
npmconfigsetprefix'~/.npm-global'nano~/.profile
source~/.profile
#Install Mermaid and phantomjs on which mermaid depends.npminstall-gphantomjs
npminstall-gmermaid
#Check if mermaid is installed by issuing the commandmermaid--h
#Generate a png using following commandmermaid-ppath/to/markdownfilewith.mdor.mmdextension.
MarkdownPlus is a good markdown editor and can be used on their hosted solution or for offline use it can be installed as a local copy and accessed from the browser by pointing the browser to the index.html. The bug from CuteMarkEd is not present here.
To access offline, you can clone it from github using following command.
Then open the folder markdown-plus and right click on the index.html file and open it using your browser of choice. Alternatively, in the browser enter file:///home/path/to/markdown-plus//index.html.
While Markdown Plus is quite a versatile browser based editor, I did not like the fact that there is no easy way to save the file you have created and all I could work out was that you will have to copy paste your text and save it using another text editor.
I felt, for this reason that the Mermaid Live editor was better compared to this option and the live editor is quite basic to be honest and can't be used offline.