KeenWrite: Live GraphViz diagramming

Hey hey,

I’ve been working on a free, open-source, plain text editor called KeenWrite. A few months ago I integrated Kroki, which supports GraphViz. The text editor provides the ability to reference variables inside the document, including within diagrams. This provides an easy way to define styles (such as colours) in one place and reference them throughout the diagram.

Here’s an example screenshot showing the family tree for characters in a novel:

The variable definitions are on the left-hand side. Each diagram starts with a typical Markdown code block, with “diagram-graphviz” to indicate that the contents are to be rendered using Kroki’s server in GraphViz format. Although the screenshot shows embedded R code to reference variables, plain Markdown documents can use the moustache format (i.e., double braces).

Here’s a simpler screenshot showing a diagram in a detached window (pressing F5 will refresh the diagram to fit the window):

Notice how the “a”, “b”, and “c” nodes have a colour that’s defined as “#{{palette.body}}”. The value for “palette.body” is defined as “2e2e2e” in the variables panel. Changing it in that one place immediately re-renders the graph using the new colour. It’s very nearly real-time because the request goes over HTTPS. The advantage is that if you hanker for more than GraphViz, all of Kroki’s diagram formats are available.

Thoughts? Comments? Questions?