It may also be worth noting that, when triggered by a DEVONthink smart rule, this script can be used in a somewhat similar fashion as the “Stream annotations …” script by @ryanjamurphy:
The main difference is that my script creates individual Markdown notes while the “Stream annotations …” script extracts a PDF’s annotations into a single file.