Open mojavelinux opened 2 years ago
Related tests in Asciidoctor PDF: https://github.com/asciidoctor/asciidoctor-pdf/blob/main/spec/diagram_spec.rb#L38-L76
@mojavelinux should we anticipate this change and set the imagesdir
attribute on the generated node today?
Since we plan to add support for the imagesdir on the image node in core (see https://github.com/asciidoctor/asciidoctor/issues/3660), one approach is to rely on that enhancement and set the imagesdir attribute on the generated node if it differs from the normal location. That way, the converter doesn't have to do any extra work.
So, if imagesoutdir
is specified we should set the imagesdir
attribute on the generated node? Maybe we should always set the imagesdir
on the generated node?
Yes, I'm confident that we can add the check for imagesdir on the node in 2.1. I'll revive https://github.com/asciidoctor/asciidoctor/pull/3661
Maybe we should always set the imagesdir on the generated node?
Can't hurt, esp since this is essentially an internal negotiation with the converter.
If the image output directory does not match the value of
imagesdir
, such as whenimagesoutdir
is specified, the converter cannot locate the fetched diagram. This particularly affects Asciidoctor PDF, which must read the image in order to embed it.The current workaround for this situation in Asciidoctor Diagram is to use an absolute path as the image target if the
data-uri
attribute is set on the document. See:Since setting the
data-uri
has other implications, we may decide to settle on a different attribute name.Since we plan to add support for the
imagesdir
on the image node in core (see https://github.com/asciidoctor/asciidoctor/issues/3660), one approach is to rely on that enhancement and set theimagesdir
attribute on the generated node if it differs from the normal location. That way, the converter doesn't have to do any extra work.