Skip to content

Commit d525378

Browse files
committed
Improvements to image grids for many different edge cases
1 parent e4b9c57 commit d525378

File tree

9 files changed

+110
-35
lines changed

9 files changed

+110
-35
lines changed

Minimal.css

Lines changed: 38 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1477,6 +1477,11 @@ a[href*="obsidian://search"] {
14771477
background-image: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100' width='17' height='17' class='search'><path fill='white' stroke='white' stroke-width='2' d='M42,6C23.2,6,8,21.2,8,40s15.2,34,34,34c7.4,0,14.3-2.4,19.9-6.4l26.3,26.3l5.6-5.6l-26-26.1c5.1-6,8.2-13.7,8.2-22.1 C76,21.2,60.8,6,42,6z M42,10c16.6,0,30,13.4,30,30S58.6,70,42,70S12,56.6,12,40S25.4,10,42,10z'></path></svg>");
14781478
}
14791479

1480+
.plain-external-links .external-link {
1481+
background-image: none;
1482+
padding-right: 0;
1483+
}
1484+
14801485
/* Reading Mode Lists
14811486
div > ol,
14821487
div > ul {
@@ -3513,32 +3518,54 @@ body {
35133518
.img-grid .image-embed.is-loaded img:active {
35143519
background-color: transparent;
35153520
}
3516-
.img-grid .markdown-preview-section {
3517-
/*img:not(.emoji):not([width]),
3518-
video {
3519-
width:100%;
3520-
}*/
3521+
.img-grid .markdown-preview-section > div:has(img) p:empty,
3522+
.img-grid .markdown-preview-section > div:has(img) img ~ br,
3523+
.img-grid .markdown-preview-section > div:has(img) .image-embed ~ br {
3524+
display: none;
35213525
}
3522-
.img-grid .markdown-preview-section > div:has(.image-embed) > p {
3526+
.img-grid .markdown-preview-section div:has(> .image-embed ~ .image-embed),
3527+
.img-grid .markdown-preview-section p:has(> .image-embed ~ .image-embed),
3528+
.img-grid .markdown-preview-section div:has(> img ~ img),
3529+
.img-grid .markdown-preview-section p:has(> .image-embed ~ img),
3530+
.img-grid .markdown-preview-section p:has(> img ~ .image-embed),
3531+
.img-grid .markdown-preview-section p:has(> img ~ img) {
35233532
display: grid;
35243533
margin-block-start: var(--img-grid-gap);
35253534
margin-block-end: var(--img-grid-gap);
35263535
grid-column-gap: var(--img-grid-gap);
35273536
grid-row-gap: 0;
35283537
grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
35293538
}
3530-
.img-grid .markdown-preview-section > div:has(.image-embed) > p > br {
3531-
display: none;
3532-
}
3533-
.img-grid .markdown-preview-section > div:has(.image-embed) > p > img {
3539+
.img-grid .markdown-preview-section div:has(> .image-embed ~ .image-embed) > img,
3540+
.img-grid .markdown-preview-section p:has(> .image-embed ~ .image-embed) > img,
3541+
.img-grid .markdown-preview-section div:has(> img ~ img) > img,
3542+
.img-grid .markdown-preview-section p:has(> .image-embed ~ img) > img,
3543+
.img-grid .markdown-preview-section p:has(> img ~ .image-embed) > img,
3544+
.img-grid .markdown-preview-section p:has(> img ~ img) > img {
35343545
object-fit: var(--image-grid-fit);
35353546
align-self: stretch;
35363547
}
3537-
.img-grid .markdown-preview-section > div:has(.image-embed) > p > .internal-embed img {
3548+
.img-grid .markdown-preview-section div:has(> .image-embed ~ .image-embed) > .internal-embed img,
3549+
.img-grid .markdown-preview-section p:has(> .image-embed ~ .image-embed) > .internal-embed img,
3550+
.img-grid .markdown-preview-section div:has(> img ~ img) > .internal-embed img,
3551+
.img-grid .markdown-preview-section p:has(> .image-embed ~ img) > .internal-embed img,
3552+
.img-grid .markdown-preview-section p:has(> img ~ .image-embed) > .internal-embed img,
3553+
.img-grid .markdown-preview-section p:has(> img ~ img) > .internal-embed img {
35383554
object-fit: var(--image-grid-fit);
35393555
height: 100%;
35403556
align-self: center;
35413557
}
3558+
.img-grid .markdown-preview-section > div:has(img) > p {
3559+
display: grid;
3560+
margin-block-start: var(--img-grid-gap);
3561+
margin-block-end: var(--img-grid-gap);
3562+
grid-column-gap: var(--img-grid-gap);
3563+
grid-row-gap: 0;
3564+
grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
3565+
}
3566+
.img-grid .markdown-preview-section > div:has(img) > p > br {
3567+
display: none;
3568+
}
35423569

35433570
/* Image zoom */
35443571
/* MIT License | Copyright (c) Stephan Ango (@kepano) */

manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "Minimal",
3-
"version": "7.5.3",
3+
"version": "7.5.4",
44
"minAppVersion": "1.5.4",
55
"author": "@kepano",
66
"authorUrl": "https://twitter.com/kepano",

src/css/main.css

Lines changed: 38 additions & 11 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/css/main.css.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/css/main.min.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/css/main.min.css.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/scss/content/links.scss

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,8 @@ a[href*="obsidian://search"] {
66
.theme-dark a[href*="obsidian://search"] {
77
background-image:url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100' width='17' height='17' class='search'><path fill='white' stroke='white' stroke-width='2' d='M42,6C23.2,6,8,21.2,8,40s15.2,34,34,34c7.4,0,14.3-2.4,19.9-6.4l26.3,26.3l5.6-5.6l-26-26.1c5.1-6,8.2-13.7,8.2-22.1 C76,21.2,60.8,6,42,6z M42,10c16.6,0,30,13.4,30,30S58.6,70,42,70S12,56.6,12,40S25.4,10,42,10z'></path></svg>");
88
}
9+
10+
.plain-external-links .external-link {
11+
background-image: none;
12+
padding-right: 0;
13+
}

src/scss/features/image-grid.scss

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -39,20 +39,25 @@ body {
3939
}
4040

4141
.markdown-preview-section {
42-
/*img:not(.emoji):not([width]),
43-
video {
44-
width:100%;
45-
}*/
46-
> div:has(.image-embed) > p {
42+
> div:has(img) {
43+
p:empty,
44+
img ~ br,
45+
.image-embed ~ br {
46+
display:none;
47+
}
48+
}
49+
div:has(>.image-embed ~ .image-embed),
50+
p:has(>.image-embed ~ .image-embed),
51+
div:has(>img ~ img),
52+
p:has(>.image-embed ~ img),
53+
p:has(>img ~ .image-embed),
54+
p:has(>img ~ img) {
4755
display: grid;
4856
margin-block-start: var(--img-grid-gap);
4957
margin-block-end: var(--img-grid-gap);
5058
grid-column-gap: var(--img-grid-gap);
5159
grid-row-gap: 0;
5260
grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
53-
> br {
54-
display:none;
55-
}
5661
> img {
5762
object-fit: var(--image-grid-fit);
5863
align-self: stretch;
@@ -63,5 +68,16 @@ body {
6368
align-self: center;
6469
}
6570
}
71+
> div:has(img) > p {
72+
display: grid;
73+
margin-block-start: var(--img-grid-gap);
74+
margin-block-end: var(--img-grid-gap);
75+
grid-column-gap: var(--img-grid-gap);
76+
grid-row-gap: 0;
77+
grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
78+
> br {
79+
display:none;
80+
}
81+
}
6682
}
6783
}

theme.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)