Closed KartikSoneji closed 10 months ago
I can add that in the diagram extension, but without support from the html5 backend it won't have much effect. Is this something the html5 backend already supports?
See https://docs.asciidoctor.org/asciidoc/latest/macros/image-svg/ for the available options
Is this something the html5 backend already supports?
I don't think it does. Maybe this should be a feature request to asciidoctor as well?
Something like opts=inline-linked
here:
(source)
if node.option? 'inline'
img = (read_svg_contents node, target) || %(<span class="alt">#{node.alt}</span>)
elsif node.option? 'interactive'
fallback = (node.attr? 'fallback') ? %(<img src="#{node.image_uri node.attr 'fallback'}" alt="#{encode_attribute_value node.alt}"#{attrs}#{@void_element_slash}>) : %(<span class="alt">#{node.alt}</span>)
img = %(<object type="image/svg+xml" data="#{src = node.image_uri target}"#{attrs}>#{fallback}</object>)
else
img = %(<img src="#{src = node.image_uri target}" alt="#{encode_attribute_value node.alt}"#{attrs}#{@void_element_slash}>)
Self linking for images has been proposed and implemented. However, it's not yet available in a release. See https://github.com/asciidoctor/asciidoctor/issues/3656
That's great! Does that support inline images as well?
Unless I'm mistaken this should just work out of the box since the diagram extension passes most attributes through to the generated block.
Edit: ah but 2.1.0 hasn't been release yet of course. Either way, I'm going to close this issue since it's something asciidoctor core should and will handle.
Yes, once 2.1.0 is released. I recommend holding out for that release rather than changing Asciidoctor Diagram, as you suggested.
Inline svgs are great but that doesn't provide access to the source svg. For example, right click > open in new tab to allow a focused view of only that image.
Can we add an option like
svg-type=inline-linked
that wraps the whole svg tag with<a href="image.svg" target="_blank">
that will open the image in a new tab when clicked?I believe the changes will need to be made here: https://github.com/asciidoctor/asciidoctor-diagram/blob/2636028423f79b2411e25ef3d7aada7c720f63ef/lib/asciidoctor-diagram/diagram_processor.rb#L255-L265