l3nz

l3nz

Not sure if I’m the only one, but I often find myself designing Elixir projects using AsciiDoctor - because I find the embedded PlantUML drawings very useful to model graphically processes, supervision trees and messages flowing between multiple GenServers.

I think that it would be useful to have such drawings as a part of the “standard” documentation that comes with an Elixir project, as generated by ExDocs - I used to do it with a JS library that does it at runtime, but it would be just as easy to leverage a local PlantUML or a webserver, generate the SVG for once, and add it to the documentation.

So I’m starting to play around with these ideas - had a couple of free hours and was able to generate and embed them, and add two functions to my SayCheezEx to allow easy generation - if you are curios, this is what I got: SayCheezEx — say_cheez_ex v0.3.6 . It’s interesting how PlantUML has actually a huge number of drawings, and a lot of them could be useful to improve documentation.

Am I the only one toying with these ideas? How could they be made better? Is there a way to make them easier to use than just

module Foo do
    import SayCheezEx, only: [uml: 1, graphviz: 1]

    @moduledoc """
    Here goes a Graphviz graph:

    #{graphviz("digraph { Sup -> GenServ }")}

    Here a PlantUML graph:

    #{uml("""
      Bob -> Alice : I do love UML in documentation
      Alice -> Bob : me too!
    """)}

    """

    ...
  end

(those functions can be massively improved - I’d like to use a local install and if not available to fall back on a webservice - and caching is not complete yet. But it’s a start…)

Showing Posts 1 to 10

kokolegorille

kokolegorille

l3nz

l3nz OP

Yes that’s what I used to do - but I like the idea of having an image generated just once, and not at runtime. And PlantUML is a powerhouse of graphs.

fuelen

fuelen

The benefit of this idea is also a drawback of it. Such approach significantly increases compilation times.

l3nz

l3nz OP

Well, yes and no, Yes - of course - when you have new or modified graphs, but the images can be cached effectively, so the difference - in practice - is unnoticeable.

hauleth

hauleth

Ideally that could be done only during documentation generation. Unfortunately there is no way to have backward compatible way to extend Markdown/CommonMark that would allow to implement such thing.

l3nz

l3nz OP

If you cache the results based on the actual graph recipe, it’s technically executed every time, but you don’t care because it does not slow you down. (Come to think of it: under which environment is documentation generated?)

hauleth

hauleth

Though it is executed every time when you compile project, which puts compile-time dependency on PlantUMl being available in your system. That can be pretty painful for CI or if your project is a library.

l3nz

l3nz OP

Actually, PlantUML is also available as a webservice, or you can even host your own, so I was thinking of trying a local version first, and going for the webservice if not installed. In the library as it is today, it uses the webservice.

hauleth

hauleth

Then you have requirement on being on-line and that you can reach given website. That also make your compilation non idempotent, which also can be not desirable, especially in corporate environments, CIs, and other environments where you want to control/disallow networks during builds.

l3nz

l3nz OP

If you need strong idempotency, you add the PlantUML binary to your local build environment, or run a local server. But my feeling is that online will be “good enough” for most of us :grinning:

— All posts loaded —

Where Next? Top

Trending in Discussions Top

AstonJ
As the title says, please share what you’ve been up to with Elixir. Whether that’s been learning it, looking into it, making stuff with i...
2977 94592 917
New
cblavier
Hey there, It’s been more than a year since we started using LiveView as our main UI library and building a whole library of UI componen...
New
mudasobwa
I am happy to introduce the very α version of the new programming language compiled to BEAM. Welcome Cure. It has literally three kille...
New
heathen
Quite interesting article Google brought me. Didn’t find any mentions about it here. What do you think in general? Would you use togethe...
New
maennchen
:warning: Security advisory: Decimal DoS vulnerability A vulnerability has been published for decimal where very large exponents can cau...
New
marciol
It would be helpful to have a list of companies worldwide that hire engineers without prior experience in Elixir. Often, it can be quite ...
New
durvia
Anyone running long-lived stateful processes on BEAM? We’re building an AI agent runtime and would love to compare notes. We’re a small ...
New

Other Trending Topics Top

marciok
Hi there! We created Gust: A task orchestrator inspired by Airflow. For those who have never heard about Aiflow, it’s a Python-based wor...
New
jimsynz
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Dmk
Xamal is a deployment tool for Elixir apps that deploys native releases to bare metal servers over SSH. It’s a port of GitHub - basecamp/...
New
netoum
Corex is an accessible, unstyled UI component library for Phoenix that integrates Zag.js state machines using Vanilla JavaScript and Live...
New
webofbits
With AI doing more of the implementation work, I’ve been wondering how much coding I should deliberately keep doing myself. My main conc...
#ai
New
webofbits
Aludel - LLM Evaluation Workbench Aludel is an embeddable Phoenix LiveView dashboard for evaluating and comparing LLM prompts across mult...
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews