Show Title of Embedded Internal File

what

is there anyway to carry the title when i am embedding a header?

explanation

i would like to see the title of the file i’m embedding into my current note when embedding a header from that file: ![[file_i_want_to_embed#header]]
image

i can see that it does work if i just embed the whole file ![[file_i_want_to_embed]]. the html class is showing there is another div for embed-title markdown-embed-title
image

tried

  • looking around at the .markdown-embed-title css but it wouldn’t show up.
  • looked at the console to see if i could get the display style to allow the title to show but that wouldn’t work either…
  • searched around on the forums but all of the information i found was relating to the removal of the title instead of the addition

After a little bit of testing I find that live preview do show the source of the embed using ::before, and that neither live preview nor reading mode actually has an element containing the file name of the embed.

There is an element indicating that a title could be included, but I’m not sure where or how to set that. And I’m not sure what is setting the ::before element within live preview.

However, I’m somewhat sure that you can’t achieve your goals with pure CSS. There seems to be the need for some extra shenanigans (read: javascript) to extract the alt or src elements from the surrounding divs to insert this into the DOM somehow. I reckon this could be achieved using some of the user based plugin tools and some coding, but I don’t have the time to go down that route.

hi ty @holroy for the response. i agree i don’t think it’s possible at this point and most likely too much of a hassle to do a work around. maybe if it comes up in a feature i’ll leverage it. thanks again!

answer

new file

i’ll probably use a new file and embed that entire file into my original note where i can. that will allow me to keep the title in and see it the way i’d like to. however, this doesn’t work if i have a lot of nested headers that i’m using, or i’d have to have a new file for each header i want to have which is probably too much.

double link

second, more readily available within my current workflow, response is to do a double link. so i am using bullet point entries in my daily notes and want to embed content from the Finished header in the some_project file:

* finished this project [[some_project]] ![[some_project#Finished]]`

which gives me the same type of view as i wanted to have. maybe even worth it to create a little quick add or template to insert these two internal links. i will post back if i end up doing that.

You could also use a Templater template to insert what you need. Slightly relevated I’m using notes in KanBan board to keep track of groups of tasks. What I actually do when I start a new note is the following:

  • Add a new card: My new project
  • Select Create new note from card ( which transforms the text into [[My new project]]
  • I then edit the card, and select the entire link, and hit Cmd Shift V to trigger the template
  • The template then, in my case, adds so the text becomes: [[My new project]] `= sum(filter([[My new project]].file.tasks, (t) => !t.completed).bt)` (This little snippet calculates my guesstimate on how much work there is to be done in that project

That’s my rather long winded way of stating that you could use Templater to change your link embed into a heading, or some other way of showcasing the file, and then repeat the embed. This would indeed allow you also to do whatever formatting you’d want for the extra section you add.