How to avoid empty lines in display of transcluded lines

Things I have tried

I have read the documentation, but couldn’t find an asnwer.

What I’m trying to do

How to avoid empty lines in display of transcluded lines

When I use transclusion to display content from another note, the editor adds an empty line above and below the transcluded text. If the source text is within a list, the editor even adds a fourth line at the top.

I find the result looks inelegant and it needlessly stretches the note vertically. Is there a way to avoid these blank lines?

1 Like

In the default theme I get the following, source view on the left, and reading view on the right:

I think I’ve seen some CSS trickery to get rid of the note title, which I’ve not applied here, but as you can see the line in front and after, can be avoided if you add the text right in front/after the embed.

If you use the text on separate lines in front and after. It seems to respect the one in front, but not the one after. And that kind of corresponds to how I see Obsidian handles all different kind of blocks with a little bit of spacing around them.

It can possibly be handled with CSS, as well. Hope this helps, to some extent.

1 Like

I think the difference we are seeing here is that transcluding entire notes is pretty clean, but when you transclude headings within a note, you get extra padding at the beginning of the transfusion (the end of the transfusion is cleaner.)

I don’t like the extra padding either, because I’d like transclusions to ‘fit’ into the rest of the note more seamlessly. The border is enough for me as an indicator, I would actually prefer the transclusion not be indented.

There is a theme that provides cleaner transclusions, but I like Minimal-

I’m also using Minimal most of the time, and they’ve got the option to set Settings > Style Settings > Minimal > Use strict embed style globally for cleaner embeds in general for the entire vault. And if that’s off, you can set cssClass: embed-strict in the frontmatter, to have the clean embeds in just that file. See Embeds - Minimal Documentation for a little more information in relation to how Minimal handles this.


Thank you for this! In ‘Live Preview’ mode it is indeed completely seamless…I wish I could enable just the border, or some small indicator for a transclusion.

I’m sure it could be done with CSS, but that’s outside my ability.