asciidoctor / asciidoctor-vscode

AsciiDoc support for Visual Studio Code using Asciidoctor
Other
340 stars 97 forks source link

Inline images in the preview aren't working. #901

Open BcOleks opened 2 months ago

BcOleks commented 2 months ago

Hi,

I am trying to preview an inline image using the extension, but the image does not get the correct path in the <img src="..."> attribute. It only gets <img src="image.png"> instead of the full path like <img src="fullPath/image.png">, as it does with block images.

Please see the screenshot for reference:

Inline image (image:image.png[]) Block image (image::image.png[])

Is this a known issue, and is it on the roadmap to be fixed? I apologize if this is a duplicated issue.

Thank you for your assistance.

image

ggrossetie commented 2 months ago

Hey, could you please share a sample document that reproduce this issue. Do you explicitly define :imagesdir:?

BcOleks commented 2 months ago

Hi @ggrossetie I will add the testmodule in which you will find page which represent the issue.

I have this module at path: ../documentation/docs/modules/testmodule

Where documentation is my repository and /docs/modules is Antora default dir for pages content.

The repository structure looks like this:

|-- documentation
|   |-- docs
|   |   |-- modules
|   |   |   |-- ROOT
|   |   |   |   |-- images
|   |   |   |   |   |-- tmp
|   |   |   |   |   |   |-- tmp.png
|   |   |   |   |-- pages
|   |   |   |   |   |-- tmp
|   |   |   |   |   |   |-- index.adoc
|   |   |   |   |   |-- index.adoc
|   |   |   |   | -- nav.adoc
|   |   |   |-- testmodule
|   |   |   |   |-- images
|   |   |   |   |   |-- test
|   |   |   |   |   |   |-- test-image.png
|   |   |   |   |-- pages
|   |   |   |   |   |-- test
|   |   |   |   |   |   |-- index.adoc
|   |   |   |   | -- nav.adoc
|   |   |-- antora.yml

Here is a content of index.adoc from testmodule:

= Test page

== Peoples

== What we do

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor image:test/test-image.png[width=1200] incididunt ut labore et dolore magna aliqua.

Here is a content of antora.yml:

name: documentation
title: Documentation
start_page: index.adoc
nav:
  - modules/ROOT/nav.adoc
  - modules/testmodule/nav.adoc

Here is a content of nav.adoc from testmodule:

* Test
** xref:test/index.adoc[]

The content of ROOT folder is not important because there is no issue with it. I will include only testmodule in tar.gz where you can find a page with issue (testmodule/pages/test/index.doc) and images dir for it - so you can check it, just include the folder testmodule into your modules directory.

Description of issue:

There is only one inline image on page and when it rendered i get such <img> definition in html - the src have incorrect path: <p><span class="image"><img src="test/test-image.png" alt="test image" width="1200"></span></p>

But when I replace it with block image I will get a correct path: <img src="/Users/username/Documents/documentation/docs/modules/testmodule/images/test/test-image.png" alt="test-image" width="1200">

No I do not define :imagesdir: explicitly - just use default value.

If you need any further information please let me know.

testmodule.tar.gz

BcOleks commented 2 weeks ago

Hi @ggrossetie, I hope you're doing well. I wanted to follow up and ask if there are any updates on this. Thank you in advance!