Add a popup feature to display diagram image in a popup window - #38
Add a popup feature to display diagram image in a popup window#38Mrzrb wants to merge 3 commits into
Conversation
- Fix image position in popup floating window - Add calculate_popup_size function for proper size calculation - Scale down large images to fit 90% of terminal while maintaining aspect ratio - Use image.nvim's adjust_to_aspect_ratio for consistent sizing - Refactor code to match project style (local x = function pattern) - Use vim.defer_fn for rendering like image.nvim does
|
It'd (at least partially, if not fully) solve the issue that caused me to ask for #36. If we were able to optionally “glue” that popup in place in the middle of the right edge of the terminal, then it'd solve that feature request directly. |
Position in this implement is dynamic, it depends on the window size, it's calculated dynamically. But is's easy to add an option to set the popup window to specific position. |
|
I'm trying to test this... but I still get inline image – what am I doing wrong? I'm pretty sure the Lazy entry is correct, because the right branch got installed: {'Mrzrb/diagram.nvim', branch = 'feature/popups', dependencies = {
{'3rd/image.nvim', build = false, opts = {}},
}, opts = {}},and then my config looks like this: -- { image.nvim & diagram.nvim
require('image').setup({
backend = 'ueberzug',
processor = 'magick_cli',
integrations = {
markdown = {
enabled = true,
download_remote_images = true,
only_render_image_at_cursor = false, -- tried `true` as well
only_render_image_at_cursor_mode = 'popup', -- still does 'inline'
floating_windows = true, -- if true, images will also be rendered in floating markdown windows
},
},
})
require('diagram').setup({
integrations = {
require('diagram.integrations.markdown'),
},
renderer_options = {
mermaid = {background = 'transparent', theme = 'dark', scale = 2},
},
})
-- }AFAIU, the gap between 2nd and 3rd line shouldn't be there (which was the reason behind #36). |

Hi! I hope you're doing well. Great work on this plugin – it's been really helpful for me!
I noticed that your image.nvim plugin includes a popup feature, while diagram.nvim currently doesn't have one. I've implemented this functionality and would greatly appreciate it if you could review this PR.
Implementation highlights:
Added a popup feature for displaying diagrams
The popup window automatically detects the current buffer's window size and adapts accordingly for optimal viewing
Thank you for your time and consideration!
Thx!
Just like this
