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
355 stars 145 forks source link

Using inline vs. block macros for images #1501

Closed ahus1 closed 10 months ago

ahus1 commented 10 months ago

Hello @ahus1, I'm having a similar issue. Observed vs. expected behavior image:: is not recognized in syntax view and in preview:

image

image: is working image

how to reproduce :

Root\
|- images
    |-trigger-fired.png
    |-trigger-actions.png
|- pages
  |- mypage.adoc

header of mypage.adoc :imagesdir: ../images/

preview only works for image: and not image::

thanks for correction.

Env info

PhpStorm 2023.3.1 Build #PS-233.11799.297, built on December 11, 2023 Runtime version: 17.0.9+7-b1087.7 amd64 VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o. Windows 11.0 org.asciidoctor.intellij.asciidoc (0.41.2) net.antelle.intellij-xcode-dark-theme (1.2.4)

Originally posted by @abonne01-pro in https://github.com/asciidoctor/asciidoctor-intellij-plugin/issues/1366#issuecomment-1864271243

ahus1 commented 10 months ago

As your preview comment was an old issue, I moved it to to a new issue.

It seems to me that you are mixing block macros (two colons ::) with inline macros (one colon :) - see here for examples: https://docs.asciidoctor.org/asciidoc/latest/macros/images/#inline-image-macro

A block macro must be on a block of its own. This means it usually has a blank line before and after. Still, it might have a title or an ID which would be part of that block. It is not enough to put it just on a single line.

So the following will work if it is on its own block:

some text

image::trigger-actions.png[]

some text

If you have an enumeration, and want to have the block macro image part of the enumeration, use a list continuation + - https://docs.asciidoctor.org/asciidoc/latest/lists/continuation/#list-continuation

. First list item
+ 
image::trigger-actions.png[]

. Another list item

In the output (and preview), you'll notice that without the + the image will start at the beginning of the line. With the +, it will have the same indentation as the list item.

I assume this answers your question. I'll therefore close this issue. Please comment if you have additional questions.

abonne01-pro commented 9 months ago

Hello,

Thanks for Precision. I think it explain my issue. But I guess it can be improved with 2 points: