Closed bbucko closed 2 years ago
It's not meant to replace asciidoctor-diagram
I think in the long run this should be merged with Asciidoctor Diagram. I'd like to see Asciidoctor Diagram be able to work in an Asciidoctor.js mode where it uses image servers to generate when access to system commands is not available. (In fact, it already has a pretty nice abstraction to the underlying commands so it shouldn't be a huge challenge). For now, of course, we can explore the use of this more minimal implementation.
In fact, there is an example of an Asciidoctor Diagram extension that uses an external service to render images. See https://github.com/hnakamur/asciidoctor-diagram-cacoo
I moved content from src attr to title and alt. This way we'll have a tooltip and some sort of accessibility.
I think you still need to escape the content though or else it could lead to broken HTML, especially since a source diagram can have any character. The content may already be partially escaped, but I know that double quotes aren't replaced with "
Yep, you're right. Could you recommend something? I'm not really a Ruby Dev :) I found htmlentities but I don't how to add a gem.
As a quick fix I escaped only " and ' chars. It seems like it's working (more or less). I'll do it properly once I figure out how to add gems or generate a class that contains all XML entities that should be escaped.
@mojavelinux could you check now?
@mojavelinux as far as I understand this PR will open the path for Antora to render PlantUML
diagrams ?
Maybe it worth create an issue in Antora
repo with links to this PR ?
Now that asciidoctor-plantuml and asciidoctor-plantuml.js both exist (and both use the PlantUML server), is this extension still needed? Or is it covered by one or both of those extensions?
This extension uses PlantUML Server to transform [plantuml] blocks into diagrams. It's not meant to replace asciidoctor-diagram but allow PlantUML diagrams to be used in asciidoctor.js without need for local installation of Graphviz.
deflate.js and encode.js files are provided by PlantUML team and I decided to use them to ensure compatibility. Deflate.js originally is in this repo: https://github.com/johan/js-deflate. encode.js is a custom implementation of base64-like encoder.
Also, I'm aware that DocInfoProcessor is missing and both js files are not included but this extension is meant to be used in AsciiDoctor.js Preview Chrome extension.