mscgen_js
Turns text into sequence charts.
- Implementation of the super easy MscGen in JavaScript.
- Embeddable in your HTML.
- Try it in the on line interactive interpreter.
- Or in Atom with the atom mscgen-preview package.
- Also:
- talks a simplified subset of MscGen for lazy bastards.
- speaks a superset of MscGen for the feature hungry.
- runs in all modern browsers (and in node.js).
- animates your chart.
Sample
This sequence chart ...
was made with this MscGen source:
msc {
a [ label="Entity A", textbgcolor="red", textcolor="white" ],
b [ label="Entity B", textbgcolor="yellow" ],
c [ label="Entity C", textbgcolor="blue", textcolor="yellow" ];
a->b [ label = "ab()" ] ;
b->c [ label = "bc(TRUE)"];
c=>>c [ label = "process(1)" ];
b<<=c [ label = "callback()", arcskip="1"];
|||;
--- [ label = "If more to run", ID="*" ];
a->a [ label = "next()"];
a=>c [ label = "ac1()"];
b<<c [ label = "cb(true)", textbgcolor="lime"];
b->b [ label = "stalled(...)"];
a<<b [ label = "ab() = FALSE", textcolor="red", linecolor="red"],
c note c [ label="Just a note ...", linecolor="green",
textcolor="green", textbgcolor="lime" ];
}
(Open this chart in the online interpreter)
mscgen_js and the MscGen standard
mscgen_js was made to go both ways:
- Accept all valid MscGen programs and render them correctly.
- Have all valid MscGen programs accepted by mscgen_js accepted and rendered correctly by MscGen.
Moreover MsGenny, the simplified subset, translates to MscGen with the flip of a switch.
If you find proof to the contrary on any of this tell us.
Building mscgen_js yourself
See build.md. If you want to understand how mscgen_js' innards work: we try to explain that in the script folder.
More mscgen_js
-
Embedding MscGen in HTML: mscgenjs-inpage
- Tight, standalone front end library that renders MscGen (and the two derivative languages) within any HTML. As used in the tutorial and the embedding guide.
npm install mscgenjs-inpage
- (This replaces the provisional bower package with the same purpose).
-
Command line interface: mscgenjs-cli
- Option syntax is similar to the original
mscgen
, so in theory you could use it as a drop-in replacement for that. npm install mscgenjs-cli
- Option syntax is similar to the original
-
MscGen package for the atom editor
-
- Library package. Contains the parsing and rendering logic for all mscgenjs.
npm install mscgenjs
License information
This software is free software licensed under GPLv3.
This means (a.o.) you can use it as part of other free software, but
not as part of non free software. We have a slight relaxation for when
you'd want to use mscgen-inpage.js
.
Commercial use of embedding mscgen using mscgen-inpage.js
In addition to the GNU public license, for the use of the minified version
of the embedding code (mscgen-inpage.js
) as described on
embedding a special exception to the GPL is made:
As a special exception to the GPL, any HTML file which merely makes function calls to mscgen-inpage.js, and for that purpose includes it by reference shall be deemed a separate work for copyright law purposes. In addition, the copyright holders of this code give you permission to combine this code with free software libraries that are released under the GNU LGPL. You may copy and distribute such a system following the terms of the GNU GPL for this code and the LGPL for the libraries. If you modify this code, you may extend this exception to your version of the code, but you are not obligated to do so. If you do not wish to do so, delete this exception statement from your version.
Dependencies and their licenses
mscgen_js is built on various libraries, each of which have their own license (incidentally all MIT style):
- requirejs is used for modularization.
- The bare (embedding only) mscgen_js is packaged using requirejs and almond to be able to run as a stand alone, dependency-less package.
- Parsers are generated with pegjs.
- The on line interpreter additionally uses codemirror.
- The command line interface uses phantomjs, amdefine and commander
- To run automated tests in node mscgen_js uses jsdom, amdefine, node-localstorage and commander.
Icons are courtesy of Dmitry Baranovskiy license.
- Icons in the animation, were created with the IcoMoon App. At the time the font was created it was licensed GPLv3 or CC BY 4.0
It uses mocha, chai, istanbul, eslint and [dependency-cruiser][41] to maintain some modicum of verifiable code quality. You can see the build history in GitHub actions and an indication of the shape of the code at Code Climate .
Thanks
- Mike McTernan for creating the wonderful MscGen language, the accompanying c implementation and for releasing both to the public domain (the last one under a GPLv2 license to be precise).
- David Majda for cooking and maintaining the fantastic and lightning fast PEG.js parser generator.
- Marijn Haverbeke for the snazzy CodeMirror editor component.
- Elijah Insua for jsdom, which makes it possible to render vector graphics in node.js.
- Audrey M. Roy for the excellent "painfully obsessive cheat sheet to favicon sizes/types.".
- Joshua Chaitin-Pollak, for suggesting to publish mscgen_js as a package.