3rd / image.nvim

🖼️ Bringing images to Neovim.
MIT License
803 stars 35 forks source link

Inline Images #138

Closed benlubas closed 3 months ago

benlubas commented 3 months ago

Inline Images

This PR introduces the concept of an inline image, and does so without breaking existing functionality. inline images are images that display "inline" with other text, they get an extmark to track their location, and they stick to that extmark.

images that have with_virtual_padding must be inline. (this is also the rule that prevents this PR from breaking existing functionality).

Motivation

I'm doing this to improve the inline latex rendering of neorg. In conjunction with the inline extmark option introduced in nvim v0.10+, this PR allows for images to easily render over concealed text and stick with the text without users of the api having to do all the work that image nvim already does for images with_virtual_padding.

I'm sure there are other similar applications too.

testing

I've daily'ed this for a few days and haven't broken it, I haven't done rigorous testing yet though.


Thoughts?

3rd commented 3 months ago

Wow, this is an awesome feature, great work! The All virtual padding images will have inline == true part is a bit confusing because inline can be false, right?

benlubas commented 3 months ago

it's meant to be like "if with_virtual_padding is true, the value of inline is ignored and assumed to be true"

we can change the wording. I just didn't want to break backwards compatibility.