I’m still trying to find a way to customize the links that the editor inserts when selecting a file from the autocomplete popup after typing [[
in the editor.
I previously asked a more general question about this here, but there hasn’t been any response. I suspect this kind of customization would require a plugin. However, I haven’t found a clear entry point for this in the plugin API.
At a minimum, I think I would need an event that fires after pressing Enter in the autocomplete popup (is that the correct name for this UI element?), so I can modify the text that’s actually inserted into the editor. Ideally, there would be an API that lets me customize the preview shown in the autocomplete popup itself.
One possible workaround I considered is listening to all changes in the editor and reacting when ]]
is entered. But this approach seems fragile and potentially inefficient — both performance-wise and in terms of false positives (e.g., when editing links manually). The EditorChange
event seems somewhat promising here, though.
Does anyone with more experience in plugin development have suggestions or ideas on how to approach this?
Here’s what I’m trying to achieve:
-
Remove the filename that’s automatically inserted in parentheses, e.g.,
My Note (<filename>)
. -
If the note has no markdown heading, insert the first sentence of the note instead.
-
Insert the filename without surrounding brackets.