Awesome! Thanks! Personally, I am using this script to unload many important blocks and regions of text into headings or blocks in “library” or “collection” notes. Within these, I compile the actual text of relevant content to be referenced as source content within new notes.
It is essentially an alternative to using atomic notes, but there is still an ability to return to the embed of the block or heading within its original context. I prefer this in some cases when I know that the material will be melding, and I want to avoid flooding the vault with excessive notes and the problems that they can entail.
I will add that with this workflow, while within the library note, it definitely becomes a bit overwhelming to look at the back links. It basically becomes necessary to use SNW plugin to see backlinks on a per heading/block basis (Relevant request: Option to sort backlinks by heading/block-ids).
Anyways, although I am not experienced enough (yet), with the help of your awesome script, I am going to look further into Templater and native Obsidian functions, to figure out whether it might actually be possible to target exactly where the heading or block get extracted to in the destination note.
Thanks again! Your help throughout this forum is greatly appreciated!