|
| 1 | +/* |
| 2 | + clean-embeds-all.css snippet |
| 3 | +
|
| 4 | + Removes title, link, padding, margins from embeds, |
| 5 | + so they really look like the same note. |
| 6 | +
|
| 7 | + This will not require a `cssclass` to be set but work for _all_ notes. |
| 8 | + Derived from the `clean-embeds.css` snippet. |
| 9 | +
|
| 10 | + 2021-08-24 Matthias C. Hormann (Moonbase59) |
| 11 | +
|
| 12 | + TODO: Find out how to correct PDF export. L/R margins & vspace too large on embeds. |
| 13 | +*/ |
| 14 | + |
| 15 | +/* remove title and the table from the "Metatable" plugin */ |
| 16 | +.markdown-preview-view .markdown-embed-title, |
| 17 | +.markdown-preview-view .obsidian-metatable { |
| 18 | + display: none; |
| 19 | +} |
| 20 | + |
| 21 | +/* |
| 22 | + For links to embeds NOT to be shown, uncomment the following |
| 23 | + and comment out the other section below. |
| 24 | +*/ |
| 25 | + |
| 26 | +/* |
| 27 | +.markdown-preview-view .markdown-embed-link, |
| 28 | +.markdown-preview-view .file-embed-link { |
| 29 | + display: none; |
| 30 | +} |
| 31 | +*/ |
| 32 | + |
| 33 | +/* |
| 34 | + For links to embeds to BE shown, uncomment the following |
| 35 | + until the "End link show/hide stuff" comment |
| 36 | + and comment out the section above. |
| 37 | +*/ |
| 38 | + |
| 39 | +/* Link icon */ |
| 40 | +.markdown-preview-view .markdown-embed-link, |
| 41 | +.markdown-preview-view .file-embed-link { |
| 42 | + top: 0; |
| 43 | + right: 0; |
| 44 | + left: unset; |
| 45 | + text-align: right; |
| 46 | + border: none; |
| 47 | + margin: 0; |
| 48 | + width: 24px; |
| 49 | + height: 24px; |
| 50 | + color: var(--text-faint); |
| 51 | + cursor: pointer; |
| 52 | +} |
| 53 | + |
| 54 | +/* for Ars Magna theme and others that change ::before */ |
| 55 | +.markdown-preview-view .markdown-embed-link::before, |
| 56 | +.markdown-preview-view .file-embed-link::before { |
| 57 | + display: none; |
| 58 | +} |
| 59 | + |
| 60 | +/* Link icon size & hide */ |
| 61 | +.markdown-preview-view .file-embed-link svg, |
| 62 | +.markdown-preview-view .markdown-embed-link svg { |
| 63 | + height: 24px; |
| 64 | + width: 24px; |
| 65 | + opacity: 0; |
| 66 | + display: unset; |
| 67 | +} |
| 68 | + |
| 69 | +/* show on hover */ |
| 70 | +.markdown-preview-view .markdown-embed:hover .file-embed-link svg, |
| 71 | +.markdown-preview-view .markdown-embed:hover .markdown-embed-link svg { |
| 72 | + opacity: 1; |
| 73 | +} |
| 74 | + |
| 75 | +/* change background on hover, to exactly see what’s embedded */ |
| 76 | +.markdown-preview-view .markdown-embed:hover, |
| 77 | +.markdown-preview-view .file-embed:hover { |
| 78 | + background-color: var(--background-secondary) !important; |
| 79 | +} |
| 80 | + |
| 81 | +/* End link show/hide stuff */ |
| 82 | + |
| 83 | + |
| 84 | + |
| 85 | +/* remove border and scroll */ |
| 86 | +/* unfortunately needs !important for some themes */ |
| 87 | +.markdown-preview-view .markdown-embed, |
| 88 | +.markdown-preview-view .file-embed { |
| 89 | + border: none !important; |
| 90 | + padding: 0 !important; |
| 91 | + margin: 0 !important; |
| 92 | +} |
| 93 | + |
| 94 | +.markdown-preview-view .markdown-embed-content, |
| 95 | +.markdown-preview-view .markdown-embed-content > .markdown-preview-view { |
| 96 | + max-height: unset; |
| 97 | + padding: 0 !important; /* !important for "Pisum" theme */ |
| 98 | + margin: 0; |
| 99 | + border: 0; |
| 100 | +} |
| 101 | + |
| 102 | +/* remove <br> between internal embeds */ |
| 103 | +.markdown-preview-section div > br { |
| 104 | + display: none; |
| 105 | +} |
| 106 | + |
| 107 | + |
| 108 | +/* remove vertical space added by markdown-preview-sizer */ |
| 109 | + div.markdown-preview-sizer.markdown-preview-section { |
| 110 | + min-height: unset !important; |
| 111 | + padding-bottom: 0 !important; |
| 112 | +} |
| 113 | + |
| 114 | +/* special considerations for printing (PDF export) */ |
| 115 | +@media print { |
| 116 | + |
| 117 | + /* remove frontmatter box if "Show frontmatter" was enabled */ |
| 118 | + /* Also remove metadata table from "Metatable" plugin */ |
| 119 | + pre.frontmatter, |
| 120 | + .obsidian-metatable { |
| 121 | + display: none; |
| 122 | + } |
| 123 | +} |
0 commit comments