I have a file which embeds an image

I have added iimage mode to the markdown mode hook and even added recenter to it
(add-hook 'markdown-mode-hook 'iimage-mode)
(add-hook 'markdown-mode-hook 'iimage-recenter)
However when I open the file the image is not loaded automatically. I have to manually run the iimage-recenter
command inside the buffer before the image is actually loaded. in the buffer. Any suggestions how I can specify to run iimage-recenter
after a particular file is loaded. I am guessing I'll have to edit some hook (maybe after-insert-file-functions?), but not sure which one.
iimage-mode
is incompatible withmarkdown-mode
.iimage-mode
just uses thedisplay
property to display paths as images whilemarkdown-mode
has thedisplay
property in its value for the variablefont-lock-extra-managed-props
. Sofont-lock
removes thedisplay
properties set byiimage-mode
immediately when it (re)fontifies (parts of) the buffer. Even if you have a fast hack to temporarily display images with iimage those images will be removed byfont-lock
when you edit text near the image or if the image is in a part of the buffer that is not yet rendered by font-lock.markdown-mode
has a commandmarkdown-toggle-inline-images
that does almost what you want. The style of the link is a bit different. The command expects the file name without url schema, i.e.,
. If you adapt to that convention you can just add'markdown-toggle-inline-images
tomarkdown-mode-hook
.