Embedding headings respects hierarchy

Use case or problem

I want to embed multiple blocks / sections based on their hierarchical relationship. But currently embedding a heading means the embed stops at the next heading, even if that is a child.

Proposed solution

I would love for heading embeds to simply respect the heading hierarchy. In other words, given this content:

## Test Heading

Content

Content

### Child heading

More content

## Next Sibling

This embed code: ![[link#Test Heading]] would display all of the above text until the “next sibling” heading. That is, embedding a second level heading would also automatically pull in third, fourth, etc level headings.

Related feature requests (optional)

3 Likes

Yes please! This would be beneficial for policy/legislation notes!

Yes please.
Also, can this be extended to layered bullet points?

Illustration:

  • Main point
    - Sub point 1
    - Sub point 2

With ![[Main point]], ideally I shouldn’t just see “-Main point” but rather the sub points as well. ![[Sub point 1]] should result in just “Sub point 1”

1 Like

you can already grab bullet points by putting the block reference under them (but this may not be exactly what you’re looking for)

e.g.,

- first point
    - second point
    - third point
^blockID

Then just embed that block id

2 Likes

Yes, thank you for that, I was not aware of this function. That said, I do think the default should be for embedded headings and bullet points to respect hierarchy - everything until a point/heading of an equal hierarchy level should be considered the same block for the purposes of embedding IMHO.

2 Likes

Tried this, but it doesn’t capture the heading, which (depending on your use) may also be important.

I think this is the crux of it! I’m glad you could write this out using language that is easy to understand. I had this idea in my head, but couldn’t figure out how to write it out!

1 Like

Wait, I’m confused. I thought this is what Obsidian does already?

(Left: embedded with ![[file#Test Heading]]; Right: Linked File)

re:

+1 for the tip! :+1:

I also want to add this introduces a bug. I haven’t filled out a proper bug report because I have not seen this feature advertised in the docs. But here is where I have documented it:

https://forum.obsidian.md/t/allow-subtree-or-raw-link-specification-in-embeds-and-link-preview-windows/19026/2

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