Exclude block in transclusion by custom css/html

Things I have tried

  • Web search
  • Search in Obsidian Forum

What I’m trying to do

I like the idea behind the “extract current section” functionality, that lets write atomic or at least short notes. I also like template blocks that help me organize my metadata consistently. Unfortunately, I don’t get those 2 things work together well.

Let’s say I have 2 notes, one is a long form style Document that describes something complicated. The other is a relatively short solution to a specific problem that the long form covers.

obsidian short note|690x399

When I include this note in the longer Note, it always includes the metadata block at the end (or at the front, if you prefer it there). I know there are some workarounds, but all of them are tedious and/or introduce limitation. It would look like this:

obsidian long note|438x500

I thought about wrapping my metadata block, which is of course a template, in some magic html/css that lets it disappear when it is being transcluded. Does anyone of you know how to do that?

Thanks a lot,

Your images doesn’t show anything, so it’s kind of hard to understand what you mean.

How is your metadata block marked up in the note you want to embed (and hide the metadata of).

It should be possible to do some hiding if you’re able to target the metadata block. In difference to a normal CSS selector to target the metadata block, you just add .markdown-embed-content in front of the other selector, then you could whatever you want with it.

You are right, it is a bit hard to understand. I hope with the following photo it is more clear:

You could give every shorter note the standard header of # Summary and then include it with ![[Note title#Summary]].

That way the # Reference section would not be included.


Your are right, this is most likely the easiest “workaround”. But it comes with the limitation for only working if everything is under 1 heading, that “References” has to be same level of heading as “Summary” and that you cannot use another heading (or else you would need to include every heading on its own) and that its a bit more Syntax each time you include something.

As i do not want this section in any transclusion, I wondered if there is a method to do this by default :slight_smile:

If you only use default headers as the markup, it’s not possible to do reliably. You could (possibly) always hide the n’th heading, but that’s not reliable.

A better would be to change the markup somehow which makes is a viable CSS target. Like adding a class (somehow), or changing it to a specific callout, or something like that.

1 Like

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