Block-insert operator

As proposed in Permanent insert of block, a !! (block-insert) operator would be extremely useful in several circumstances.

The existing ability to link to blocks is terrific functionality that makes it possible to rapidly extract notes from existing sources, without having to creating dozens of independent, “atomic” notes.

The block-insert operator would extend that capability, making it possible to outline a document with a series of block links, and then compose the document by inserting the blocks they point to.

Use case or problem

I’m working on an article now that describes a process for creating publications from Obsidian. The gist of is creating an outline using headings, nested bullets and links to blocks. The next step is to expand those links, replacing them with the text they point to.

Since the ! operator doesn’t do a true transclusion (and since true transclusion is a very difficult thing to automate, what with the need to properly manage heading levels and list indents) the only realistic alternative is to copy the block the link points to, insert it in place of the link, and do the manual massaging necessary to get an ersatz “transclusion”.

(Replacing the text can also be beneficial, since it preserves the original block, isolating it from changes that would make the revised block inappropriate in the current context. But there is also a loss of functionality. In the ideal world, the replacement would be accompanied by an invisible link to the original block. Lots of ways to use such a link, once it exists, but that (admittedly impractical) bit of wishful thinking needs to be set aside for the time being.)

Proposed solution

The !! “insert block” operator would provide an easy mechanism to convert an outline composed of links to a “document note” that is ready for export.

That operator could be copied, then pasted in front of each link in turn, pausing only long enough to “massage” the last block-insert into shape before moving to the next one.

Current workaround (optional)

The operation is carried out manually at the moment by opening the link, copying the block it points to, and pasting it as a replacement for the link.

Related feature requests (optional)

This just occurred to me. If I can find it as an existing request I’ll come back and link to it here.

When inserting a block, it would also be very handy to add a source attibution. Each reference to a book, of course, needs a page number. So those need to be in the block. But the title of the book, or a link to an article or lecture, is an attribute of the entire reference document.

That reference could be encoded as metadata in the “reference document”. Every block inserted from the reference would then be followed by the attribution, on a subsequent line. (The metadata attribute could be called “attribution” or maybe “source”.)

Personal notes wouldn’t have an attribution attribute, of course. So nothing happens in that case, but a block inserted from a note containing extracts from a book might wind up looking something like this:

"…inserted text… (p. 302)

  • The Best Book Ever, by Yours Truly


  • I always start reference fragments with a quotation mark, to distinguish them from notes I’ve added. Styles may differ, in that regard, but something of the kind is a useful practice.
  • “(p. 302)” is included in the block
  • The referenced document contains an “attribution” field in the metadata that reads, “Book, by Author”. The attribution is then automatically added–ideally in a format dictated by the user (in this case: new line, indent, hyphen, space, attribution (pretty standard, so it’s a reasonable default, and customizability can be deferred).
1 Like

Depending on what markup you use in the included blocks, another workaround might be to switch to reading mode to select and copy the whole note. (This will lose or change some markup, like task lists.)

Also, in your current workaround, if you want to invisibly preserve the link to a block after copy-pasting it in, you can put the link in an Obsidian comment (%%[[Notes on subject#^pertinent point]]%%) and it will remain active (unfortunately this doesn’t work in HTML comments).

That’s a bit hand-wavy; hard to understand what it is exactly you are trying to do. To be clear, this isn’t some new syntax you are proposing but a shortcut for copy-pasting block contents?

Pending clarity on the use case aside, seems like this plug-in might help

1 Like

Looks like a handy plugin, for sure. The functionality I’m looking for is a combination of “put block embed on the clipboard”, “replace block embed with the text of the embed”, and “paste”.

Macro capability would make it possible, but I suspect that kind of “ultimate generality” is overkill. In essence. the idea is to do this:

  1. Open a link like [[this topic]]
  2. When you visit it, copy the material from that block.
  3. Go back to the original pane, select the link, and paste the contents of the clipboard to replace the link.

That invisibility hack is a nice one! Thanks for that. Had I known about it, I would have added it to the original proposal (which can no longer be edited, alas…)

You’re right that a new operator isn’t entirely necessary. A command of some sort would also work. But the operator would be handy. Instead of permanently assigning a keystroke the command, you can copy the operator and make Ctrl+V a “temporary command” that does what you want while you’re expanding your outline/link-list.

Foiled by the 20-minute edit limit.
For extra credit, add one more step:
4. ALSO include the original link in a comment, so the original material can be accessed when needed, as suggested by @CawlinTeffid :_)

I like the idea of being able to smartly copy over the content of a transclusion and replacing the original transclusion, possibly commenting it out.

However, I feel like a right-click menu-item on the transclusion block, or a button (similar to the small link button in the top-right corner of a transclusion) would be a more logical way of providing that functionality. Adding an additional exclamation point in front of the link, just for it to be replaced immediately when the transclusion link is replaced with the content.


I like this idea a lot! I also wanted to add a link to a related feature request:

In that request it takes multiple transclusions and actualities them into full text. The example has full note embeds converted, but there is no reason it shouldn’t also work on headings and blocks. In fact, I probably should edit it.