With the paste
hook you can modify the text that will be pasted in Nota.
You can open the hook for the current workspace by going to the Command Palette...(⌘⇧P) and selecting "Open Paste Hook". By default Nota creates a hook that does nothing:
#!/bin/bash
# @parameters clipboardText
In the previous example you could have noticed the @parameters clipboardText
comment. This comment tells Nota to pass the current clipboard contents as a first argument to the script.
You can pass a few different values to the paste hook:
clipboardText
– the text contents of the clipboardselectedText
– the currently selected text, empty string if no text is selectedfile
– the path to the currently opened fileworkspace
– the path to the currently opened workspace
To tell Nota which values to pass to the script add a @parameters
decorator with the parameters separated by spaces: @parameters selectedText file workspace
. This will make: $1
the selected text, $2
the currently edited file and $3
the path to the currently opened workspace.
- Privacy URLs – A lot of URLs have tracking data. Why not remove the tracking data for your most common URLs?
- Paste URL over text – Create a markdown link when pasting an URL and there is a text selected. A small productivity hack.
- Format pasted text – You may want to strip indents, replace a specific word with another, replace an URL with a markdown link.