Skip to content

sverweij/mscgen_js

Repository files navigation

mscgen_js

Turns text into sequence charts.

Build Status mscgen.js.org

Sample

This sequence chart ...

a sample sequence chart, rendered as png

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
  • MscGen package for the atom editor

    • Has real-time rendering, W00t syntax highlighting, svg & png export and some other cool stuff. Check it out on github or on atom.io.
    • Installing: directly from within Atom or with the atom package manager (apm install mscgen-preview).
  • mscgenjs-core

    • 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):

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.

Thanks