asciidoctor / asciidoctor-diagram

:left_right_arrow: Asciidoctor diagram extension, with support for AsciiToSVG, BlockDiag (BlockDiag, SeqDiag, ActDiag, NwDiag), Ditaa, Erd, GraphViz, Mermaid, Msc, PlantUML, Shaape, SvgBob, Syntrax, UMLet, Vega, Vega-Lite and WaveDrom.
http://asciidoctor.org
MIT License
434 stars 106 forks source link

Add client/server support for all diagram types #183

Closed pepijnve closed 2 years ago

pepijnve commented 6 years ago

Make it possible to run asciidoctor-diagram as a diagram generating web service. This would enable usage of the diagram extension in the browser for instance. Very similar to what https://github.com/eshepelyuk/asciidoctor-plantuml.js is already doing, but that only supports PlantUML since it uses the plantuml server directly.

pepijnve commented 6 years ago

Consider making the web service interface compatible with that of PlantUML (see http://plantuml.com/server). Having a service that offers a superset of the PlantUML service while also serving as a drop-in replacement for it could be useful. This would only support the rendering part of the PlantUML server.

PlantUML expects GET /<format>/<encoded> where

mojavelinux commented 5 years ago

Solving this would open up Asciidoctor Diagram to users of Antora, the browser extensions, and modern IDEs like Atom and VSCode. Since these tools use Asciidoctor.js, it currently puts Asciidoctor Diagram out of reach. If Asciidoctor Diagram could be used as a service, it would bridge the language gap and bring it back into play.

asciidoctor-plantuml.js is no doubt going to play an important role, but we know there are many more diagramming tools out there with which Asciidoctor Diagram integrates. So we can't stop at PlantUML. Being able to use Asciidoctor Diagram is vital for Asciidoctor users, regardless of the environment.

The API PlantUML exposes is a good start and certainly worth supporting for portability. But don't hold back if you need to introduce something more sophisticated.

jagedn commented 5 years ago

Hi

I'm playing with the idea and I've started a prototype that you can see in action at http://adoc-diagram.puravida-software.com:8080

This server accepts GET request following the pattern /diagram/{diagram-type}/{data64} and by the moment only generate a png image as response where:

The backend is a micronaut app with asciidoctorj:1.5.6 + asciidoctorj-diagram:1.5.10 dependencies who try to build the adoc on the fly using the arguments and returns the image generated by the libraries

mojavelinux commented 5 years ago

To be compatible with the PlantUML HTTP API, perhaps consider /diagram/{type}/{format}/{data64} even if you only support png at the moment.

jagedn commented 5 years ago

good idea.

Also I moved the app to the port 80 ( http://adoc-diagram.puravida-software.com )

I was trying to include as many types I can but some of them are difficult to include, so by the moment the app can work with:

I've created a docker version in case someone want to run it without the server at 'pvidasoftware/adoc-diagram'

ggrossetie commented 5 years ago

@jagedn Nice, is the code available on GitHub ?

jagedn commented 5 years ago

Hi,

the code is in Gitlab at https://gitlab.com/puravida-software/asciidiagram the documentation is at https://puravida-software.gitlab.io/asciidiagram and a live version is running at http://asciidiagram.puravida-software.com/

pepijnve commented 2 years ago

I'm not planning any further work on this. A rudimentary Sinatra app is available in lib/asciidoctor-diagram/http/server.rb; anything more sophisticated is covered by Kroki. Delegating rendering to a server has been delivered as well a while ago.