modl Manual Override Diagram Language Open the editor

Attributes

After the id (for nodes) or the last id (for edges) come up to five attributes, always in the same order. Each one is optional.

#SlotNode valuesEdge values
1sizetiny small normal big bigger huge
2styleshape: none circle square diamond triangle hexline style: solid dashed dotted bold
3colorgray black white red orange yellow green teal blue purple pink brown
4urla word starting with /, http://, https://, www. or mailto:
5textall remaining words, to the end of the line

The values are described in detail on Sizes, shapes, lines & colors and Links & image nodes.

How words are recognized

The words after the id are read left to right against the slots, in order:

  1. If the next word is a size, it becomes the size.
  2. If the next word is a shape (for a node) or a line style (for an edge), it becomes the style.
  3. If the next word is a color, it becomes the color.
  4. If the next word looks like a URL, it becomes the link.
  5. Whatever is left is the text, joined with single spaces.

A quoted word never fills steps 1 to 4, so it always starts the text.

Each slot is checked once, in that order, and the reader never goes back. Omitting a slot is therefore free, and any combination works, as long as the attributes you include stay in order:

Any subset, in order
a big
b hex
c red
d /example.com
e Just text
f big red
g hex /example.com Shape and link
h small diamond teal
i big square blue /example.com All five
Open in editor
The same for edges
a -> b bold
c -> d red
e -> f dotted /example.com
g -> h big dashed purple /example.com All five
Open in editor

Out-of-order words become text

Once the reader has moved past a slot, a word that belongs in that slot is no longer recognized. It and everything after it become label text. This is the most common surprise in modl. The highlighting shows the result:

Wrong order: the extra words end up in the label
a red big          # color, then size: "big" is text
b circle small     # shape, then size: "small" is text
c blue square      # color, then shape: "square" is text
d red blue         # only one color: "blue" is text
Open in editor
Fixed
a big red
b small circle
c square blue
d blue
Open in editor

The same applies to edges, and to node shapes used on edges or line styles used on nodes. Those words aren't valid in that position at all, so they always become text:

Wrong vocabulary
a -> b red dashed     # color, then style: "dashed" is text
c dashed              # line styles aren't shapes: "dashed" is text
c -> d circle         # shapes aren't line styles: "circle" is text
Open in editor

Text

The text is everything after the last recognized attribute. It may contain spaces, punctuation, Unicode and even reserved words, since the attribute slots have already been passed by the time text starts:

Reserved words inside text are just words
a square Big red circle with a dashed border
a -> b Edges can say bold or blue too
Open in editor

Whitespace between words of text collapses to single spaces, and text ends at a comment. Only one URL is recognized; a second URL-like word is plain text.

Second URL is text
docs /example.com see also /example.org
Open in editor

Text can mix plain and quoted words. The quotes are removed and the words are joined with single spaces, while whitespace inside the quotes is kept:

Plain and quoted words in text
a square Step "1 -> 2" of "#3"     # label: Step 1 -> 2 of #3
Open in editor

Starting text with a reserved word

If the label should begin with a reserved word, the reader will take that word as an attribute instead. For example, n big data makes a big node labeled "data". The simplest fix is to quote the word, or the whole label:

Problem
a big data
b red alert
c circle of friends
d hex nut
Open in editor
Fixed: quote the label
a "big" data
b "red alert"
c "circle of friends"
d 'hex' nut
Open in editor

Another way is to fill a later slot explicitly, so the reader is already past the slot the word belongs to. The color slot is usually the easiest, using the default gray if you don't want a color: b gray red alert. For edges, a -> b "dashed line" or a -> b gray dashed line labels a gray, solid edge "dashed line". To start text with something that looks like a URL, quote it: a "/etc/hosts" file.

Case

Reserved words are recognized only in lowercase. Big, RED and Circle are always text, which is one more way to start a label with one of these words:

Capitalized words are text
a Big Data
b Red Alert
Open in editor