Flush Inline embeds

Godsend this, thank you works a treat!!!

Hi! Do you still need a solution for this?

If yes, I’ve found that you can hide ALL scrollbars (including in hover previews) using a plugin called Hider.

It also allows to hide other stuff but you can choose what to hide (although, if you toggle “hide scrollbars” it will hide ALL of them throughout the whole app - I personally like it this way but it may be a con for some people).

Hope this helps!

Hey, thanks for the awesome css snippet, the overly large block references were a bit distracting!
I was also wondering if I can assign a different background color to the embed. That could give it a slightly better cue where the block starts and ends. Currently, it is a bit hard to notice where the block reference is by only looking at the link symbol.

For all that read this late (the original post is a long time ago):

3 Likes

Thanks very much, your posts were very helpful! (Also showing the link icon only on hover is neat). For everyone else wondering how it’s done, just add the following to the CSS snippet:

/* change background color, to exactly see what’s embedded */
.markdown-preview-view .markdown-embed,
.markdown-preview-view .file-embed {
  background-color: var(--background-secondary) !important;
}

Sorry for being late to the show (the last post was in April, tho), but why open up a new thread, if this one was right on topic :wink:

1 Like

I’ve been trying this out, and of the flush inline options it seems to be the best. However, I’ve having an issue with newlines inside embeds being removed, as well as those between embeds. I’m not great with CSS, but I know the issue is under /* remove <br> between internal embeds */. Any ideas?

With that portion commented out:

With normal css:
image

Source for embed:
image

Edit: the same issues seems to apply to the preview on hovering.

1 Like

Hi I’m having a few problems, I don’t think this is really working for me. There is still a lot of space on the bottom of the block reference:
Screenshot 2021-09-14 at 11.23.35
Screenshot 2021-09-14 at 11.23.42

This is the referenced Note
Screenshot 2021-09-14 at 11.23.58

Any ideas?

1 Like

Updated for the new default theme:

/* Display embedded notes in line with other block elements */

/* Remove the embed heading */
.embed-title {
  display:none;
}

/* Align embed text with normal text */
.markdown-embed {
  padding-left: 0px;
  border-left: none;
}

/* Highlight the entire embed when hovering */
/* NOTE: Tested approaches to highlight the embed only when hovering
 * over the embed link. These conflicted with other styles and mouse
 * events. I opted for the simpler approach and kept it subtle. */

.markdown-embed:hover {
  backdrop-filter: invert(1%);
  box-shadow: 0 0 1px 3px rgba(136, 136, 136, 0.1);
}
5 Likes

Thanks for this !

Very nice. I’ve been looking for a good balance between “seamful” and seamless. I like to know that I’m looking at an embed, but not want that to be distracting. Ideally, I would like for the embed to be structurally seamless – i.e., the text sits where it is supposed to, not offset or padded or wrapped differently, etc., but with subtle yet clear visual cues that it is embed. And it would be nice to see the path to the file on, e.g., hover. This snippet helps a lot in giving me a good starting place for all this :slight_smile:

3 Likes

You can also try this, works well with the above:

/* 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, img.cm-widgetBuffer) {
  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 */ 
}
3 Likes

To make all embedded reference except for images inline

.internal-embed/* [alt*='^'] */:not(.image-embed) {
  display: inline-block;
  vertical-align: middle;
}
2 Likes

I added the following to look as “inline” as possible.

.markdown-preview-sizer {
  min-height: 0px !important;
}

I am a fan of text embeds but not the huge block quotes Obsidian puts them in. The latest update broke something in my css snippet, so I rewrote it after looking over this thread:

/*inline-style embeds in reading mode*/
.markdown-embed { /* remove blockquote */
  padding-left: 0px;
  border-left: none;
}
.embed-title { /* remove padding over embed */
  display:none;
}
.internal-embed[alt*='^'] :is(p, ul, li) { /* remove extra bullets*/
  margin: 0;
}
li .markdown-embed ul ul { /* fix indented list inside list */
  padding-left: 2.3em;
}
.markdown-embed-link, .file-embed-link { /* link icon position */
  position: absolute;
  top: 0em;
  right: -1em;
}

This makes reading mode look inline. (My use case is to put certain bullet points into other lists) But I have no idea how to fix the live edit mode. I usually prefer to edit in source, but it’s inconvenient that I can’t see what embeds say while editing.

1 Like