asciidoctor / asciidoctor-intellij-plugin

AsciiDoc plugin for products on the IntelliJ platform (IDEA, RubyMine, etc)
https://intellij-asciidoc-plugin.ahus1.de/
Apache License 2.0
347 stars 146 forks source link

Images aren't appearing in the preview #1276

Closed KLynn2019 closed 1 year ago

KLynn2019 commented 1 year ago

Observed vs. expected behavior

Images are no longer appearing in the writer's plugin preview pane. When he opens the same repository in Visual Studio Code, the images appear in that preview. They are also appearing when he generates the help site using Antora.

Steps to reproduce

Both of us have IntelliJ projects that contain multiple repositories. The screenshots below reflect the same repository, branch, and commit.

Here's what he's seeing.

noimages

Here's what I'm seeing.

images

Environment

Plugin Version: 0.38.4 (him), 0.38.7 (me)

IntelliJ Details: The original issue occurred in 2022.3. He upgraded to 2022.3.2 (RC) but the issue remains. I am using version 2022.3.1.

We are both using Windows 10.

ahus1 commented 1 year ago

Sorry to hear this is happening, and thanks for collecting all that information.

I tried to replicate it with a local setup (Windows 11, IntelliJ 2022.3.2 (RC), Plugin 0.38.4, still without success.

Please have a look at the settings that are marked in yellow below. The "Preview Browser" should be set to "JCEF Browser", "Safe-Mode" should be set to "UNSAFE", and "Attributes" should be empty.

To double-check that the imagesdir attribute is set correctly, add a plain text {imagesdir} that should show the image folder location in the preview: For a regular page in an Antora component, it should be a relative folder to the images (for example: ../images if the page is directly in the pages folder).

Please let me know what you see. If it still doesn't work, I'll add another comment to continue tracking down the problem.

image

KLynn2019 commented 1 year ago

imagesdir is already set in line 2. I didn't include it in the original screenshots.

noimages2

Our settings match those in your screenshot. He's still not seeing images; I'm still seeing them.

ahus1 commented 1 year ago

Thank for the additional screenshot.

Could you please add a the following snippet into an existing page. Replace the image with an image block macro which exists in your project.

It shows some attribute values and the HTML to show an image:

{imagesdir}

{outdir}

{imagesoutdir}

{docdir}

+++<textarea rows=20 cols=80>+++

// just put any existing image in here
image::preamble.png[alt="test",title="title"]

+++</textarea>+++

It should produce a snippet in the preview like this:

image

It would be great to see the full paths in the screenshot to see if there are any special characters in it which could cause trouble. If you don't feel comfortable to share the screenshot in this issue, please send it to the email address provided in my GitHub profile.

I hope this gets us one step closer to an answer. Thanks!

KLynn2019 commented 1 year ago

Note the highlighted portions of these screenshots. The first is mine (I'm able to see the images):

imagekl

The second is his (he's not able to see the images):

image2

His folder names and organization are unchanged from when he was last able to see images.

ahus1 commented 1 year ago

Thanks for collecting all that information.

I noticed that the path name with the broken images contained a blank. This put me on a lead and I think I might have found a piece of code that might have cause the the problem: It checked for blanks in the path and then applied a different logic which seems broken to me.

There is now pre-release 0.38.8 which contains the fix. Please give it a try first on your machine to make sure it doesn't break anything obvious. Then give it a try on your colleague's IDE and let me know if it resolves this issue.

The pre-release of the plugin is available from GitHub releases and the IntelliJ AsciiDoc EAP repository.

KLynn2019 commented 1 year ago

I was able to update the plugin and still see the images.

When he went to update the plugin, there was no Update button available. Checking for updates didn't pull it. Uninstalling and reinstalling the plugin didn't pull it either. His AsciiDoc plugin version is "stuck" at 0.38.4.

Here's his IntelliJ version information:

IntelliJ IDEA 2022.3.2 RC (Community Edition) Build #IC-223.8617.20, built on January 17, 2023 Runtime version: 17.0.5+1-b653.25 amd64 VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o. Windows 10 10.0 GC: G1 Young Generation, G1 Old Generation Memory: 1972M Cores: 8

Kotlin: 223-1.8.0-release-345-IJ8617.20

ahus1 commented 1 year ago

Hi @KLynn2019 - good to know that the preview version didn't break things for you.

As your IDE was able to install it from the marketplace, I assume you've opted in to the EAP release channel of the plugin - see this link for the docs: https://intellij-asciidoc-plugin.ahus1.de/docs/contributors-guide/user/add-eap-repository-to-ide.html

I assume for your colleague it would be better to install just this one preview release. Follow this link to see the steps necessary: https://intellij-asciidoc-plugin.ahus1.de/docs/contributors-guide/user/installing-a-preview-release.html (in a nutshell: download it from the GitHub releases of this repository, and then install the ZIP file)

Please let me know if this works for him.

KLynn2019 commented 1 year ago

That seems to have done the trick. He's seeing the images now. Thank you SO much!

ahus1 commented 1 year ago

What a relief! Thanks for collecting all the necessary bits of information and your patience.

I'll keep this release as a preview release for some more days. I plan to promote it as the regular release by the end of the week, and then it is rolled out to all users via the marketplace (no manual install necessary).

ahus1 commented 1 year ago

I just published release 0.38.9 to the marketplace which includes this fix. Closing this issue.