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
435 stars 106 forks source link

Relative inter-document(html to html) links in interactive plantuml diagrams do not work when using data-uri #356

Closed sachman closed 3 years ago

sachman commented 3 years ago

Hi, Interdocument navigation works perfectly when I refer to another local document in plantuml diagram as follows:

[plantuml%interactive, {autogendir}highLevelBrkDwn, svg, subs=attributes+]
....
@startwbs
* Software Development
** [[{autogen_to_basedir}/public/StandardProductImprovement.html{Go to Process Document} Standard Product Improvement]]
*** [[https://google.com Feature Addition/Improvement]]
*** [[ Bug Fix]]
** [[ New Product Development]]
** [[ Internal(Organizational) Requirements]]
@endwbs
....

image

However, when I use :data-uri:, clicking the local document link leads to a blank blocked page in the browser, as follows: plantuml_doclink_datauri

What am I doing wrong?

UPDATE:

[[{docdir}/../public/StandardProductImprovement.html Standard Product Improvement]]

Doing this resolves the link now. However, the link only opens by right clicking and opening in new tab.

Also, as the path is now getting absolute, it will not be resolved outside the system in which its generated.

pepijnve commented 3 years ago

I don't think this has anything to do with this extension directly. The :data-uri: attribute does not impact the SVG that's generated by PlantUML. It's the HTML5 backend that handles the encoding of the SVG in a data: URI.

What you might be bumping into is how the browser resolves relative URIs located inside an SVG document that has been embedded as a data: URI. From what I can tell this simply doesn't work. Safari for instance shows me this error for the relative link. The absolute one to google works fine.

image
pepijnve commented 3 years ago

Using inline instead of interactive does seem to work. Is that an option for you? This embeds the SVG content directly in the generated HTML instead of using an <object> tag with a data: uri. That way the base URI of the SVG document is well defined and relative URI resolution seems to work correctly.

sachman commented 3 years ago

Hi @pepijnve , Thanks for helping me out.

inline works great for me and it solved a major missing piece, though I am not aware of any other limitations that it may pose in future.

I was not sure where to get help in this context, hence asciidoctor-diagram was what I could see. I am sorry if I have spammed.

I have edited the issue title to what I could understand from your statements.

As the issue is not relevant to this plugin, I am closing this.

Thanks again for your help.