tobiasah / mkdocs-caption

MkDocs plugin to add captions and easy element numbering
MIT License
3 stars 2 forks source link

Inline images sometimes are processed as figures #9

Closed annjulyleon closed 5 months ago

annjulyleon commented 5 months ago

Mkdocs-material: latest (in docker)

Some inline images get processes as figures.

Example of inline image: Hover over ![Filter icon](img/filter_icon.png) to view a tooltip.

Expected behaviour: inline images are not processed by mkdocs-caption. Inline images are not numbered, without caption, no new lines or paragraph breaks.
Actual behaviour: some inline images become figures and break paragraph layout. However, some inline images are working as intendent. I could not pinpoint what exactly causes inline images behave like figures :( Any advice is welcome!

tobiasah commented 5 months ago

Thanks for raising this issue.

I agree that inline images should not be parsed. I will take a look into it.

tobiasah commented 5 months ago

I could reconstruct the problem if inline images are using an alt text. In that case, the plugin would treat the alt text as a caption and convert the image into a figure.

I adapted the code to ignore inline images with alt text. Hopefully, this works stable ... its a bit tricky to determine if an image is inline or not ... as a fallback, I have added a new config entry ignore_alt to manually disable the usage of alt text.

Hopefully, this resolves the issue for you. If not let me know, and we will figure it out 😇