Closed mariotoffia closed 3 years ago
Hi Mario!
Yes this is working as expected.
The include::
directive is a preprocessor directive.
It imports content from an external file into the content of the current document. When the current document is processed, the include directive syntax is replaced by the contents of the include file
A preprocessor directive is processed when the lines of a document are read, but before the document structure is parsed.
In other words, when the Asciidoctor Kroki extension is called all includes are already resolved. For instance, in the following example, I'm using an include:
subdir/overview.adoc
This is an overview.
excalidraw::file.json
main.adoc
= Main
include::subdir/overview.adoc[]
But from a block extension point of view (i.e., excalidraw::
), this is exactly the same as:
main.adoc
= Main
This is an overview.
excalidraw::file.json
So file.json
will be resolved relative to the main (top-level) document.
If you really want to resolve file.json
relative to overiew.adoc
then you can use the include::
directive:
subdir/overview.adoc
This is an overview.
[excalidraw]
....
include::file.json
....
@Mogztter Many thanks for your prompt answer and again - thanks for this awesome library!
Cheers, Mario :)
Hi and again, thanks for this great software! :)
I don't know if this is a bug or not but, including excalidraw is different from standara adoc includes. The former is always relative to the main included document (that in my case includes an additional adoc document, that in it's turn includes the excalidraw diagrams).
main.adoc -> include:: -> ../a/folder/overview.adoc -> excalidraw::a-file.json (do not work since it thinks it is relative main.adoc and not relative overview.adoc).
main.adoc -> include:: -> ../a/folder/overview.adoc -> include::b.adoc do work and is relative overview.adoc.
Is this by design?
Cheers, Mario :)