Actually we're simply taking advantage of the web view (where the note is rendered) Print functionality, which can also export to PDF. Basically we get this PDF export for free, however there's not really a programmatic API where we can take some HTML and get a PDF back. Like a browser it only work for the currently loaded view.

Implementing custom scripts would be useful but a bit complicated in terms of UI. It wouldn't make sense to support just one command, so we would need something to manage a list of commands, to add them, remove them, modify them etc. We would also need a way to pass arguments to these commands, for example the currently selected notebook, or currently selected note. We can use the same convention as the CLI ($b for the notebook, $n for the note).

Then we can have a commands like ~/bin/create_notebook_pdf.sh $b or ~/bin/send_by_mail $n, etc. And these scripts will use the API to retrieve notes and notebooks.

Feel free to give it a try if you want. It can be done but it's not straightforward I think.

To make it simpler, maybe we can use the same approach as Sublime Text for the build system - just a series of JSON files which can be manually edited. Here's an example:

{
	"shell_cmd": "~/bin/create_notebook_pdf.sh $b",
	"cwd": "$HOME",
}