Extract selection to heading

What I’m trying to do

I would like to be able to select text, trigger the Templater script, choose a note, and finally type text to either choose an existing heading or define a new one. The result would be that the selected text gets extracted into the heading in the chosen note. Within the source note, in place of the extracted text, a link or embed of the destination heading would be left.

As bonus, it would be useful to be able to extract to a new heading immediately within a chosen existing heading.

Things I have tried

I created a help thread here on the forum: Best way to extract content to new headings within comp file (leaving behind embed of heading). But the thread has since been closed due to inactivity.


I replied in the other thread, but for completeness for anyone coming from Google, here’s how you do this. It’s a really cool idea, I might start using this as part of my process!


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!

1 Like

Awesome! I’m curious how you are considering using this within your process. In my previous post in this thread, I mentioned trying to use it by extracting into Library notes where I collect ideas to be melded together.

I am rethinking that approach, but still find the script very useful for extracting to more atomic collections of ideas to be related. I prefer to build notes that are not reliant upon plugins. But at the same time I regularly use plugins.

The SNW plugin is useful for identifying the backlinks of a specific heading. But, in order to avoid this reliance without having to scan through large backlink lists, I am going to try to alter your script so that immediately within the heading that the text gets extracted to, there will be a link to the a block-id or heading that the script will append above the embed that the script leaves behind in the source note in place of the extracted text.

I am not necessarily requesting for you to help with this, as I believe this is something I am likely capable of creating. But I figured you might be interested in case you wanted to implement a solution to accomplish this or something similar to this.

Thanks so much!

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.