You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
First, thanks for your awesome plugin! I have an idea for a feature and some thoughts how it could be done (I do not know the code base well, so it is what it is).
Problem
In my markdown files, I wish I could see big images but only for specific images. Most of my images should be constrained by max_width and max_height.
Proposed solution
A simple syntax can be used for instance {width=500}, where a dict like syntax could be used between {} to override options.
Alternatively, to avoid parsing syntax, command that list the images in the Markdown file in a picker then select one image and edit its options with a simple menu. I think the latter option is better
Anyway, the image would have value of the Image or its ImageOptions (not sure the one is interesting) being overridden.
I think persistence for such a overriding is relevant. I saw there is a cache in image.renderer.lua:cache. There could be (another) persistent cache stored in user .cache folder or .local/state/nvim/image where a file named <md_path>:<img_path> could store the edited options. The renderer would look at this folder when rendering the <img_path> in the markdown file <md_path>. It would make the width/height persistent, or any other Image options that are worth saving.
More, the fact that the renderer just has to read a file with a deterministic path (markdown current file and image path) seems efficient to me. Expect if the rendered is decoupled from the markdown file (location to render). Then, it could not have option specific to location where it is rendered.
Note
Not sure this is a smart proposition regarding your implementation. I am just brain storming and throwing ideas.
Result
Chosen images in markdown will have a preview that could be set manually e.g setting width and height or other options if other people see an interest.
Alternative
I did not find any other way of doing this with existing features. I believe it could be a cool features for image.nvim! I saw that using the Lua API it is possible to control such things but it's not accessible in the Markdown integration.
First, thanks for your awesome plugin! I have an idea for a feature and some thoughts how it could be done (I do not know the code base well, so it is what it is).
Problem
In my markdown files, I wish I could see big images but only for specific images. Most of my images should be constrained by
max_widthandmax_height.Proposed solution
A simple syntax can be used for instance
{width=500}, where a dict like syntax could be used between{}to override options.Alternatively, to avoid parsing syntax, command that list the images in the Markdown file in a picker then select one image and edit its options with a simple menu. I think the latter option is better
Anyway, the image would have value of the
Imageor itsImageOptions(not sure the one is interesting) being overridden.I think persistence for such a overriding is relevant. I saw there is a cache in
image.renderer.lua:cache. There could be (another) persistent cache stored in user.cachefolder or.local/state/nvim/imagewhere a file named<md_path>:<img_path>could store the edited options. The renderer would look at this folder when rendering the<img_path>in the markdown file<md_path>. It would make the width/height persistent, or any other Image options that are worth saving.More, the fact that the renderer just has to read a file with a deterministic path (markdown current file and image path) seems efficient to me. Expect if the rendered is decoupled from the markdown file (location to render). Then, it could not have option specific to location where it is rendered.
Note
Not sure this is a smart proposition regarding your implementation. I am just brain storming and throwing ideas.
Result
Chosen images in markdown will have a preview that could be set manually e.g setting width and height or other options if other people see an interest.
Alternative
I did not find any other way of doing this with existing features. I believe it could be a cool features for image.nvim! I saw that using the Lua API it is possible to control such things but it's not accessible in the Markdown integration.
Thanks again for your time!