/* If this doesn't work, try this. Found when selecting .markdown-source-view.mod-cm6 .cm-content > [contenteditable=false] */ /* ===== Remove the placeholder alt img ===== */ /* Select the placeholder alt image that appears when Obsidian doesn't render the link. Notes: - Has 2 duplicates to support "http" and "https" - .auto-embed-hide-display is for when the url is a web image so the plugin shouldn't embed it and it'll show this image instead */ /* Normal / default when pasting without any other content */ img[src^="https:"]:has(+ .auto-embed-container:not(.auto-embed-hide-display)), img[src^="http:"]:has(+ .auto-embed-container:not(.auto-embed-hide-display)), /* When there is other content on the same line as the embed. Not intended to use the plugin this way but in case the user does it, */ .cm-line:has(+ .auto-embed-container:not(.auto-embed-hide-display)) img[src^="https:"], .cm-line:has(+ .auto-embed-container:not(.auto-embed-hide-display)) img[src^="http:"] { display: none !important; } /* When the cursor is on the line with the embed */ .auto-embed-container + img[src^="https:"], .auto-embed-container + img[src^="http:"] { display: none !important; } /* When it's in a list */ .HyperMD-list-line:has(+ .auto-embed-container) img[src^="https:"], .HyperMD-list-line:has(+ .auto-embed-container) img[src^="http:"] { display: none !important; } /* Removes obsidian's embeds */ /* iframe[src^="https://platform.twitter.com/embed"].external-embed, iframe[src^="https://www.youtube.com/embed"].external-embed { display: none !important; } */ iframe.auto-embed { max-width: 100%; /* min-height: 500px; */ } /* NOTE: Using 'auto-embed' as a prefix for everything to prevent other plugin's CSS from affecting this plugin */ .auto-embed { transition: opacity var(--auto-embed-anim-duration) linear, height var(--auto-embed-anim-duration) ease-in-out; height: 100%; } /* Hide visi */ .auto-embed-hide-visibility { /* display: none; */ opacity: 0; /* height: 0; */ padding: 0; visibility: hidden; } .auto-embed-hide-display { display: none !important; } .auto-embed-container { /* Obsidian durations: --anim-duration-moderate --anim-duration-slow */ --auto-embed-anim-duration: var(--anim-duration-slow); display: block; max-width: 100%; height: fit-content; position: relative; margin: 2px 0; text-overflow: ellipsis; transition: opacity var(--auto-embed-anim-duration), height var(--auto-embed-anim-duration) ease-in-out; } .HyperMD-list-line { &.HyperMD-list-line-1 + div.auto-embed-container { margin-left: 1.4em !important; } &.HyperMD-list-line-2 + div.auto-embed-container { margin-left: 3.65em !important; } } .auto-embed-placeholder { position: absolute; top: 0; left: 0; padding: 0.9em 1.1em; height: 100%; width: 100%; border: var(--border-width) solid var(--background-modifier-border); border-radius: var(--radius-m); background-color: var(--background-secondary); text-align: left; overflow: auto; &.auto-embed-click-to-load { cursor: pointer; } & p { margin: 0; } } /* Base snippet from: https://css-loaders.com/spinner/#20 */ .auto-embed-loader { display: inline-block; height: 1em; /* width: 50px; */ aspect-ratio: 1; border-radius: 50%; border: 3px solid var(--interactive-accent); animation: l20-1 0.8s infinite linear alternate, l20-2 1.6s infinite linear; } @keyframes l20-1{ 0% {clip-path: polygon(50% 50%,0 0, 50% 0%, 50% 0%, 50% 0%, 50% 0%, 50% 0% )} 12.5% {clip-path: polygon(50% 50%,0 0, 50% 0%, 100% 0%, 100% 0%, 100% 0%, 100% 0% )} 25% {clip-path: polygon(50% 50%,0 0, 50% 0%, 100% 0%, 100% 100%, 100% 100%, 100% 100% )} 50% {clip-path: polygon(50% 50%,0 0, 50% 0%, 100% 0%, 100% 100%, 50% 100%, 0% 100% )} 62.5% {clip-path: polygon(50% 50%,100% 0, 100% 0%, 100% 0%, 100% 100%, 50% 100%, 0% 100% )} 75% {clip-path: polygon(50% 50%,100% 100%, 100% 100%, 100% 100%, 100% 100%, 50% 100%, 0% 100% )} 100% {clip-path: polygon(50% 50%,50% 100%, 50% 100%, 50% 100%, 50% 100%, 50% 100%, 0% 100% )} } @keyframes l20-2{ 0% {transform:scaleY(1) rotate(0deg)} 49.99%{transform:scaleY(1) rotate(135deg)} 50% {transform:scaleY(-1) rotate(0deg)} 100% {transform:scaleY(-1) rotate(-135deg)} } .auto-embed-hide .auto-embed-loader { display: none; } .auto-embed { /* Times: --anim-duration-moderate --anim-duration-slow */ transition: opacity var(--auto-embed-anim-duration) linear, height var(--auto-embed-anim-duration) ease-in-out; width: 100%; height: 100%; } /* Handle bullet list */ .HyperMD-list-line > .is-collapsed ~ .auto-embed-container{ display: none; } /* Default fallback */ .default-fallback-embed-container { display: inline-block; height: 100%; width: 100%; text-align: center; /* Padding for the link */ padding-bottom: calc(1em + var(--line-height-normal) * 1em); } iframe.default-fallback-embed { width: 100%; height: 100%; } /* Twitter */ .twitter-embed { width: 600px; height: 350px; min-height: unset; } /* YouTube Shorts */ .youtube-shorts-embed { height: 560px; aspect-ratio: 9/16; } /* YouTube */ .youtube-embed { /* Default size of YouTube videos when using Share > Embed option on YoutTube's website */ /* width: 560px; height: 315px; */ width: 100%; aspect-ratio: 16 / 9; } /* Error */ .error-embed { border: 3px solid #555; border-radius: 15px; padding: 10px; color: var(--text-error); margin: 0; } /* Steam */ .steam-embed { /* Default size of Steam previews when using Embed option on Steam's website */ /* width: 646px; height: 190px; */ width: 100%; height: 190px; /* Even if height is set to very big and width is small, it doesn't change the height, and height stays at 190px. So set a fixed height.*/ } /* Reddit */ .reddit-embed { height: 240px; width: 100%; /* height: 500px; */ } /* Spotify */ .spotify-embed-container { left: 0; width: 100%; height: 80px; position: relative; :has(> iframe) { height: 100%; } } .spotify-embed-container.spotify-song-large, .spotify-embed-container.spotify-playlist-small { height: 152px; } .spotify-playlist-embed { height: 369px; } .spotify-embed { width: 100%; height: 100%; top: 0; left: 0; position: absolute; } /* CodePen */ .codepen-embed { width: 100%; height: 300px; /* min-height: 300px; */ } /* Google Docs */ .google-docs-embed-edit-default { height: 76.5rem; width: 100%; } .google-docs-embed-preview { width: 100%; aspect-ratio: 4/5; } .google-docs-embed-edit-minimal { width: 100%; height: 70rem; } /* TikTok */ .tiktok-embed { /* max-width: 605px; min-width: 325px; */ width: 325px; /* Default at 700px to prevent some Cumulative Layout Shift while waiting for tiktok to send the resize message */ height: 700px; border-radius: 7px; } /* SoundCloud */ .soundcloud-embed { width: 100%; height: 166px; } /* Imgur */ .imgur-embed { width: 300px; height: 300px; }