Include note name in heading link embed

I think it would be helpful to have the note name as part of the heading link embed. it could be small font, top-right, near the link button (which is how I’ve styled note names in the regular note embeds).

5 Likes

was just about to make this FR as well, originating from Can I have file name in the transcluded header?

Many have asked for how to disable the title in file embeds, and it’s easy to do with a css snippet. However, I have the opposite where I always want to see the originating note title, which is shown when embedding the whole note, but not if embedding a section.

It could be default off for same default behavior with an option to toggle it.

Not sure about best default styles, but I’ve also made my embed title smaller and out of the way like this:

Here’s what a section embed looks like for me right now

And how I’m imagining it

Was seeing if it’s possible with css

Can kinda do something like this to show the note name before the transcluded box

.internal-embed::before { content : attr(src) ;}

Could almost modify the heading inside but the css attr() function cannot get the src attribute many parents up.

.internal-embed > .markdown-embed > .markdown-embed-content > .markdown-rendered > .markdown-preview-section > div > h1::before { content : "[[" attr(src) "]]" ;}

Got a workaround:

Show a non hidden version of ![[Note#Section]] before the embed

.internal-embed::before { content : "![[" attr(src) "]]";}

and then hide the first heading in the embed

.internal-embed > .markdown-embed > .markdown-embed-content > .markdown-rendered > .markdown-preview-section  > div:nth-child(2) > h1[data-heading="Text"],
.internal-embed > .markdown-embed > .markdown-embed-content > .markdown-rendered > .markdown-preview-section  > div:nth-child(2) > h2[data-heading="Text"],
.internal-embed > .markdown-embed > .markdown-embed-content > .markdown-rendered > .markdown-preview-section  > div:nth-child(2) > h3[data-heading="Text"],
.internal-embed > .markdown-embed > .markdown-embed-content > .markdown-rendered > .markdown-preview-section  > div:nth-child(2) > h4[data-heading="Text"],
.internal-embed > .markdown-embed > .markdown-embed-content > .markdown-rendered > .markdown-preview-section  > div:nth-child(2) > h5[data-heading="Text"],
.internal-embed > .markdown-embed > .markdown-embed-content > .markdown-rendered > .markdown-preview-section  > div:nth-child(2) > h6[data-heading="Text"] { 
  display: none
}

where the last snippet is inspired from this thread, but doesn’t break error messages.

Example: