Skip to content

Relative path Included diagrams work in preview but not in document in parent folder, or in exports #935

@muteboy

Description

@muteboy

I have a document with nested includes, with several included D2 and PlantUML files. All the includes use relative paths.
Here's an example of the folders and includes (names changed):

document root folder/Main.adoc
document root folder/Chapter1/Chapter1.adoc
document root folder/Chapter1/Diagram.d2

In Main.adoc:
include::Chapter 1 folder/Chapter1.adoc[] (relative path)
In Chapter1.adoc:
d2::Diagram.d2[] (relative path)

When I preview view Chapter1.adoc, the diagrams appear correctly.

When I preview Main.adoc, or when I export to HTML, I get this error where the diagram should be:
ENOENT: no such file or directory, open 'c:\Users\Matthew.Petty\MY EMPLOYER\MY FOLDER\document root\Diagram.d2' - d2::c:\Users\Matthew.Petty\MY EMPLOYER\MY FOLDER\document root\Diagram.d2[]

When I export to PDF, I see this where the diagram should be:
d2::Diagram.d2[]

I can see the path is wrong here. It should include Chapter1, like this:
c:\Users\Matthew.Petty\MY EMPLOYER\MY FOLDER\document root\Chapter1\Diagram.d2'

But the paths are correct in the document, and they display in the preview.

Am I missing something?


Version: 1.98.1 (user setup)
Commit: 2fc07b811f760549dab9be9d2bedd06c51dfcb9a
Date: 2025-03-10T15:38:08.854Z
Electron: 34.2.0
ElectronBuildId: 11160463
Chromium: 132.0.6834.196
Node.js: 20.18.2
V8: 13.2.152.36-electron.0
OS: Windows_NT x64 10.0.26100

Name: AsciiDoc
Id: asciidoctor.asciidoctor-vscode
Description: Provides rich language support for AsciiDoc.
Version: 3.4.2
Publisher: asciidoctor
VS Marketplace Link: https://marketplace.visualstudio.com/items?itemName=asciidoctor.asciidoctor-vscode

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions