mingrammer / diagrams

:art: Diagram as Code for prototyping cloud system architectures
https://diagrams.mingrammer.com
MIT License
37.37k stars 2.44k forks source link

Create DSL language #675

Open artefactop opened 2 years ago

artefactop commented 2 years ago

Hi there,

I like diagrams and I want to use it for my company documentation, we create the documentation as Markdown inside /docs folder (we use MkDocs to render it later). The workflow I want to build is the following:

So currently I have to add a previous step of Markdown to web render to build the diagrams images.

Proposal: Would be great to create a DSL language for diagrams. That way, we can create a Markdown plugin for python and included it on MkDocs and render everything in just one step.

Benefits:

So we can pass from:

# diagram.py
from diagrams import Diagram
from diagrams.aws.compute import EC2
from diagrams.aws.database import RDS
from diagrams.aws.network import ELB

with Diagram("Web Service", show=False):
    ELB("lb") >> EC2("web") >> RDS("userdb")

To:


diagram "Web Service" {
}

aws.network.elb "lb" {
  diagram = "Web Service"
  link_to = "web"
}

aws.compute.ec2 "web" {
  diagram = "Web Service"
  link_to = "userdb"
}

aws.database.rds "userdb" {
  diagram = "Web Service"
}

A good start point to build the language will be HashiCorp configuration language

bytehello commented 2 years ago

This is a good idea