Attributes for Embedded Sections

TL;DR
Give us attribute options that will let us choose, per instance, whether or not to show the reference page title or section title in addition to the embedded content. Currently we can only choose one way for the entire vault by altering CSS.

There are significant requests for block level embeds/transclusion. Section Embedding is a reasonable approach, considering Obsidian’s commitment to markdown. But to bring Section Embedding closer to the utility of block embedding, we need some way to choose what is shown.

Approach Suggestion:

The pretty print partition of an internal link isn’t currently used for embeds so it seems like a natural position to take advantage of.

![[Page Title#Section Title|{include:PageTitle,SectionTitle}]]

Alternatively, recognize something like curly braces as the container for attributes, leaving the pipe section available.

![[Page Title#Section Title{include:PageTitle,SectionTitle}]]

Something like this approach seems to be used by Pandoc

![[Page Title#Section Title]]{include:PageTitle,SectionTitle}

Depending on the default style chosen in Obsidian, the attributes could be reversed,

![[Page Title#Section Title]]{hide:PageTitle,SectionTitle}

As an additional way to manage embedded sections gracefully, this is related to

17 Likes

Embed Attributes could provide some other heavily requested features as well. Consider how this could provide extremely granular transclusion. This example references Obsidian Help/How To/Format your notes.md

In Editor: using inclusive brackets [ ]

In Obsidian, [[Format your notes#Developer notes{subsection:[we:markdown.]}]]

or using exclusive brackets ( )

In Obsidian, [[Format your notes#Developer notes{subsection:(therefore : It)}]]

Both of these would produce the following result In Preview:

In Obsidian, we use a slightly unorthodox combination of flavors of markdown.

Our attributes would define a granular transclusion by searching for the exact bracket reference within the referenced section. Inclusive or exclusive brackets would give users flexibility to choose the best framing to maintain integrity during potential future edits. Furthermore, a “smart” link icon should show if the link is broken so we have a reference check as we make edits to source documentation.

Below is the [[Help/How To/Format your notes#Developer notes]] section content for easy reference


`## Developer notes

We strive for maximum capability without breaking any existing formats, therefore we use a slightly unorthodox combination of flavors of markdown. It is broadly CommonMark, with the addition of some functionality from GitHub Flavored Markdown (GFM), some latex support, and our chosen embed syntax, which you can read more about at [[Accepted file formats]].

6 Likes

This is a really cool idea. In general, using [[]] brackets as a function wrapper with parameters and arguments sounds powerful and could be a part of the plugin API.

4 Likes

+1. I think this is a useful feature.

I think we also need parameters on paragraphs or line for long notes where specific words appear many times though.

2 Likes

Wouldn’t be this a little excluding? For regular users? (Like me for example. I’m striving to understand Regex…and to remember all that syntax)

I think we’re just trying to create options that will help with our workflow rather than not have options.

If you’re using Markdown, you’re already part of the club. No exclusion :wink: We have to deal with syntax for everything we write. Each user learns the syntax needed for their workflow. The idea is that there’s some logic and association behind the syntax, so hopefully it would be easy to remember (unlike regex, which is crazy).

Since Obsidian is committed to markdown, which means not relying on any hidden format encoding, we try to come up with ways to get what we need through syntax.

In the Embedded Section suggestion, the syntax is pretty straight forward. Choose an instruction include: or hide: and an attribute to act on PageTitle or SectionTitle

{hide:SectionTitle}

In the Granular Transclusion comment, I’m just throwing up a suggetion that would provide some way to address what so many Obsidian users want, Block Referencing.

Here the syntax is simply add some instruction that makes sense – for the example, I’ve chosen subsection: followed by starting and ending words that frame the block I’m interested in referencing. The choice of bracket style is a mathematics convention for Intervals, not regex.

{subsection:[I think ; have options.]} would show only the first paragraph in this reply :wink:

Though I suspect people might prefer block: for the reference syntax.

{block:[I think ; have options.]}

1 Like

Yes, I want inline style embedding for block embedding that I can link and cite a sentence in another sentence.

the Dynalist and all the other note app can do this, why Obsidian does not consider this feature.

2 Likes

I also need this feature, I link to headings quite often, they always show the headers(very annoying), but I don’t want these headers, I just want their content,

1 Like

Also, the clean-embeds css snippet workaround doesn’t work

1 Like