mirror of
https://github.com/nix-community/nixvim.git
synced 2025-06-21 08:35:43 +02:00
plugins/image: add resolveImagePath option
This commit is contained in:
parent
33097dcf77
commit
78f6166c23
1 changed files with 15 additions and 0 deletions
|
@ -66,6 +66,20 @@ in
|
||||||
filetypes = helpers.defaultNullOpts.mkListOf types.str filetypesDefault ''
|
filetypes = helpers.defaultNullOpts.mkListOf types.str filetypesDefault ''
|
||||||
Markdown extensions (ie. quarto) can go here.
|
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 ``
|
||||||
|
-- fallback is the default behavior
|
||||||
|
return fallback(document_path, image_path)
|
||||||
|
end
|
||||||
|
''';
|
||||||
|
'';
|
||||||
|
};
|
||||||
};
|
};
|
||||||
in
|
in
|
||||||
mapAttrs mkIntegrationOptions {
|
mapAttrs mkIntegrationOptions {
|
||||||
|
@ -150,6 +164,7 @@ in
|
||||||
download_remote_images = v.downloadRemoteImages;
|
download_remote_images = v.downloadRemoteImages;
|
||||||
only_render_image_at_cursor = v.onlyRenderImageAtCursor;
|
only_render_image_at_cursor = v.onlyRenderImageAtCursor;
|
||||||
inherit (v) filetypes;
|
inherit (v) filetypes;
|
||||||
|
resolve_image_path = v.resolveImagePath;
|
||||||
};
|
};
|
||||||
in
|
in
|
||||||
mapAttrs (_: processIntegrationOptions) integrations;
|
mapAttrs (_: processIntegrationOptions) integrations;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue