asciidoctor / asciidoctor-reveal.js

:crystal_ball: A reveal.js converter for Asciidoctor and Asciidoctor.js. Write your slides in AsciiDoc!
http://asciidoctor.org
Other
287 stars 189 forks source link

Diagrams using the python 'diagrams' tool - is this working? #488

Closed krimple closed 1 year ago

krimple commented 1 year ago

I'm trying to use the Diagrams API to generate a diagram like this:

[diagrams]
....
from diagrams import Diagram, Cluster
from diagrams.aws.database import RDS
from diagrams.aws.network import PrivateSubnet, NATGateway, InternetGateway, PublicSubnet, VPC, ELB
from diagrams.aws.compute import ElasticContainerServiceService

with Diagram("Networking Stack", show=False) as diag:
    ingw = InternetGateway("Internet GW")
    with Cluster("Region: us-east-2"):
        with Cluster("AZ: us-east-2a"):
            with Cluster("Vpc", direction="LR"):
                with Cluster("Public Subnet") as pubsn:
                    ngw1 = NATGateway("NAT1")
                with Cluster("Private Subnet") as privsn:
                    alb1 = ELB("Load Balancer")
                    ecs = ElasticContainerServiceService("NodeJS Container")

    ingw << ngw1 << alb1 << ecs
    alb1 >> ecs

diag
....

This works in a Jupyter notebook using the Python diagrams library, and renders the diagram to a file. I can't get it to work from my asciidoctor-revealjs build, which looks like this:

#!/bin/bash

rm -R ./reveal.js/images
mkdir ./reveal.js/images
cp -R ./src/images/* reveal.js/images
asciidoctor-revealjs -a slides \
      -D reveal.js -a revealjsdir=. \
      -a experimental=true \
      -r asciidoctor-diagram \
      src/slide-deck.adoc -o index.html

(note, I'v also set the the -a diagrams-python value to the directory of that library in my venv)

So does anyone have the diagrams library (which generates darn nice AWS and other cloud diagrams) working via the asciidoctor-revealjs module? I'd like to use it to help document some full-stack architectures for an internal training class and would love to do it without resorting to using Python batch jobs to pre-generate the images.

Many thanks, I'm hoping this is a PEBCAK but am thinking maybe it's not supported anymore and the docs still have it in the chart API list?

I'm on an M1 Macbook Pro running Ruby version ruby 2.7.2p137, python 3.9.7, and node v18.9.1 (though that doesn't matter until we actually run the server and that's functioning fine).

See this section of the asciidoctor-diagrams extension (https://docs.asciidoctor.org/diagram-extension/latest/).

image

krimple commented 1 year ago

And as I'm putting this issue together maybe the issue should be closed and reside in asciidoctor-diagram - it seems like the docs on the asciidoctor-revealjs page might be older as the asciidoctor-diagram project doesn't list the 'diagrams' library? Anyway, any advice is helpful even if it helps fix the docs.

barthel commented 1 year ago

Asciidoctor Diagram does not provide the diagrams library itself. You need to install diagrams yourself or use a Docker image (e.g. https://hub.docker.com/r/uwebarthel/asciidoctor) that provides it.

The list shown above represents only the converters implemented in Asciidoctor Diagram for the tools.

Screenshot 2023-03-30 at 08-36-10 The Intrepid Chronicles

barthel commented 1 year ago

In my opinion, this topic could be closed, @obilodeau

ggrossetie commented 1 year ago

Documentation could be improved. Feel free to submit a pull request. In the meantime, I'm closing this issue.