plugins/image: add resolveImagePath option

This commit is contained in:
Maxime Costalonga 2025-03-09 16:28:09 +00:00 committed by Matt Sturgeon
parent 33097dcf77
commit 78f6166c23
No known key found for this signature in database
GPG key ID: 4F91844CED1A8299

View file

@ -66,6 +66,20 @@ in
filetypes = helpers.defaultNullOpts.mkListOf types.str filetypesDefault ''
Markdown extensions (ie. quarto) can go here.
'';
resolveImagePath = helpers.mkNullOrLuaFn' {
description = "Configures how to resolve image paths.";
example = lib.literalExpression ''
lib.nixvim.mkRaw '''
function(document_path, image_path, fallback)
-- document_path is the path to the file that contains the image
-- image_path is the potentially relative path to the image. For markdown, it's `![](this text)`
-- fallback is the default behavior
return fallback(document_path, image_path)
end
''';
'';
};
};
in
mapAttrs mkIntegrationOptions {
@ -150,6 +164,7 @@ in
download_remote_images = v.downloadRemoteImages;
only_render_image_at_cursor = v.onlyRenderImageAtCursor;
inherit (v) filetypes;
resolve_image_path = v.resolveImagePath;
};
in
mapAttrs (_: processIntegrationOptions) integrations;