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.

You could try this css, works for default theme:

/* Code kindly provided by @zamsyt#4459 on discord */

:is(li, .HyperMD-list-line) > .internal-embed[alt*='^'] {
  display: inline-block;
  vertical-align: middle;

.internal-embed[alt*='^'] :is(p, ul, li) {
  margin: 0;   /* This makes spacing top, bottom, and between list items */
  padding: 0.5;  /* Putting this on 0 makes checkboxes and bullets disappear (?) */

.internal-embed[alt*='^'] .markdown-embed {
  padding: 0;   /* This doesnt do anything */

.internal-embed[alt*='^'] + :is(br, {
  display: none;   /* Don't know what this does */

.internal-embed[alt*='^'] .markdown-embed-link {
  display: none;   /* This hides the link symbol */
  right: -1px;  /* Increasing the number makes the link symbol disappear in the right border */ 

Edit: just a quick and dirty paste of my personal css, use with caution and forgive my inline comments :wink:

@holroy - you just made my day! Just toggled Minimal theme on and all those transcluded internal block links on canvas surfaces aren’t so bad now.

Another death blow to atomicity and the chunking up of long notes into fundamental units :grinning:


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