@@ -112,67 +112,67 @@ below:
112112 {
113113 default = {
114114 -- file and directory options
115- dir_path = "assets", ---@type string
116- extension = "png", ---@type string
117- file_name = "%Y-%m-%d-%H-%M-%S", ---@type string
118- use_absolute_path = false, ---@type boolean
119- relative_to_current_file = false, ---@type boolean
115+ dir_path = "assets", ---@type string | fun(): string
116+ extension = "png", ---@type string | fun(): string
117+ file_name = "%Y-%m-%d-%H-%M-%S", ---@type string | fun(): string
118+ use_absolute_path = false, ---@type boolean | fun(): boolean
119+ relative_to_current_file = false, ---@type boolean | fun(): boolean
120120
121121 -- template options
122- template = "$FILE_PATH", ---@type string
123- url_encode_path = false, ---@type boolean
124- relative_template_path = true, ---@type boolean
125- use_cursor_in_template = true, ---@type boolean
126- insert_mode_after_paste = true, ---@type boolean
122+ template = "$FILE_PATH", ---@type string | fun(context: table): string
123+ url_encode_path = false, ---@type boolean | fun(): boolean
124+ relative_template_path = true, ---@type boolean | fun(): boolean
125+ use_cursor_in_template = true, ---@type boolean | fun(): boolean
126+ insert_mode_after_paste = true, ---@type boolean | fun(): boolean
127127
128128 -- prompt options
129- prompt_for_file_name = true, ---@type boolean
130- show_dir_path_in_prompt = false, ---@type boolean
129+ prompt_for_file_name = true, ---@type boolean | fun(): boolean
130+ show_dir_path_in_prompt = false, ---@type boolean | fun(): boolean
131131
132132 -- base64 options
133- max_base64_size = 10, ---@type number
134- embed_image_as_base64 = false, ---@type boolean
133+ max_base64_size = 10, ---@type number | fun(): number
134+ embed_image_as_base64 = false, ---@type boolean | fun(): boolean
135135
136136 -- image options
137- process_cmd = "", ---@type string
138- copy_images = false, ---@type boolean
139- download_images = true, ---@type boolean
137+ process_cmd = "", ---@type string | fun(): string
138+ copy_images = false, ---@type boolean | fun(): boolean
139+ download_images = true, ---@type boolean | fun(): boolean
140140
141141 -- drag and drop options
142142 drag_and_drop = {
143- enabled = true, ---@type boolean
144- insert_mode = false, ---@type boolean
143+ enabled = true, ---@type boolean | fun(): boolean
144+ insert_mode = false, ---@type boolean | fun(): boolean
145145 },
146146 },
147147
148148 -- filetype specific options
149149 filetypes = {
150150 markdown = {
151- url_encode_path = true, ---@type boolean
152- template = "", ---@type string
153- download_images = false, ---@type boolean
151+ url_encode_path = true, ---@type boolean | fun(): boolean
152+ template = "", ---@type string | fun(context: table): string
153+ download_images = false, ---@type boolean | fun(): boolean
154154 },
155155
156156 vimwiki = {
157- url_encode_path = true, ---@type boolean
158- template = "", ---@type string
159- download_images = false, ---@type boolean
157+ url_encode_path = true, ---@type boolean | fun(): boolean
158+ template = "", ---@type string | fun(context: table): string
159+ download_images = false, ---@type boolean | fun(): boolean
160160 },
161161
162162 html = {
163- template = '<img src="$FILE_PATH" alt="$CURSOR">', ---@type string
163+ template = '<img src="$FILE_PATH" alt="$CURSOR">', ---@type string | fun(context: table): string
164164 },
165165
166166 tex = {
167- relative_template_path = false, ---@type boolean
167+ relative_template_path = false, ---@type boolean | fun(): boolean
168168 template = [[
169169 \begin{figure} [h]
170170 \centering
171171 \includegraphics[width=0.8\textwidth]{$FILE_PATH}
172172 \caption{$CURSOR}
173173 \label{fig:$LABEL}
174174 \end{figure}
175- ]], ---@type string
175+ ]], ---@type string | fun(context: table): string
176176 },
177177
178178 typst = {
@@ -181,19 +181,19 @@ below:
181181 image("$FILE_PATH", width: 80%),
182182 caption: [$CURSOR],
183183 ) <fig-$LABEL>
184- ]], ---@type string
184+ ]], ---@type string | fun(context: table): string
185185 },
186186
187187 rst = {
188188 template = [[
189189 .. image:: $FILE_PATH
190190 :alt: $CURSOR
191191 :width: 80%
192- ]], ---@type string
192+ ]], ---@type string | fun(context: table): string
193193 },
194194
195195 asciidoc = {
196- template = 'image::$FILE_PATH[width=80%, alt="$CURSOR"]', ---@type string
196+ template = 'image::$FILE_PATH[width=80%, alt="$CURSOR"]', ---@type string | fun(context: table): string
197197 },
198198
199199 org = {
@@ -203,14 +203,14 @@ below:
203203 #+CAPTION: $CURSOR
204204 #+NAME: fig:$LABEL
205205 #+END_FIGURE
206- ]=], ---@type string
206+ ]=], ---@type string | fun(context: table): string
207207 },
208208 },
209209
210210 -- file, directory, and custom triggered options
211- files = {}, ---@type table
212- dirs = {}, ---@type table
213- custom = {}, ---@type table
211+ files = {}, ---@type table | fun(): table
212+ dirs = {}, ---@type table | fun(): table
213+ custom = {}, ---@type table | fun(): table
214214 }
215215<
216216
@@ -428,7 +428,7 @@ The drag and drop feature enables users to drag images from the web browser or
428428file explorer into the terminal to automatically embed them, in normal mode.
429429Drag and drop can also be enabled in insert mode by setting the
430430`drag_and_drop.insert_mode` option to `true` . For drag and drop to work
431- properly, the following is required by the terminal emulator :
431+ properly, the terminal emulator must meet the following requirements :
432432
4334331. The terminal emulator must paste the file path or URL to the image when it is dropped into the terminal.
4344342. The text must be inserted in bracketed paste mode <https://cirw.in/blog/bracketed-paste >, which allows Neovim to differentiate pasted text from typed-in text.
0 commit comments