From 57263cb4d015a57f279de30b867fb73c01c8cd82 Mon Sep 17 00:00:00 2001
From: "Charles.Day" <47104966+AstroNomen@users.noreply.github.com>
Date: Tue, 24 Dec 2024 14:03:10 +0100
Subject: [PATCH 1/6] add caption rendering
when render the image, also render the markdown caption
---
layouts/_default/_markup/render-image.html | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/layouts/_default/_markup/render-image.html b/layouts/_default/_markup/render-image.html
index 0ed5584..df4f7f9 100644
--- a/layouts/_default/_markup/render-image.html
+++ b/layouts/_default/_markup/render-image.html
@@ -1,6 +1,7 @@
{{- $image := .Page.Resources.GetMatch (printf "%s" (.Destination | safeURL)) -}}
{{- $Permalink := .Destination | relURL | safeURL -}}
{{- $alt := .PlainText | safeHTML -}}
+{{- $title := .Title | safeHTML -}}
{{- $Width := 0 -}}
{{- $Height := 0 -}}
{{- $Srcset := "" -}}
@@ -38,4 +39,7 @@
data-flex-grow="{{ div (mul $image.Width 100) $image.Height }}"
data-flex-basis="{{ div (mul $image.Width 240) $image.Height }}px"
{{ end }}
->
\ No newline at end of file
+>
+{{- if $title }}
+{{ .Title }}
+{{- end }}
From 6be4e9f58ad15ccab5ed2b3c244cb471f545bc98 Mon Sep 17 00:00:00 2001
From: "Charles.Day" <47104966+AstroNomen@users.noreply.github.com>
Date: Tue, 24 Dec 2024 14:06:05 +0100
Subject: [PATCH 2/6] add figure caption scss
---
assets/scss/partials/layout/article.scss | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/assets/scss/partials/layout/article.scss b/assets/scss/partials/layout/article.scss
index 10e2706..5df3c72 100644
--- a/assets/scss/partials/layout/article.scss
+++ b/assets/scss/partials/layout/article.scss
@@ -40,6 +40,17 @@
img {
max-width: 100%;
height: auto;
+ display: block;
+ margin: 0 auto;
+ }
+
+ figcaption {
+ margin-top: 0.5em;
+ font-size: 0.8em;
+ color: var(--card-text-color-secondary);
+ font-style: italic;
+ font-weight: bold;
+ text-align: center;
}
}
From 57d4880d3b21fc851f37afc1535b4b53f6d299cb Mon Sep 17 00:00:00 2001
From: "Charles.Day" <47104966+AstroNomen@users.noreply.github.com>
Date: Tue, 24 Dec 2024 14:17:03 +0100
Subject: [PATCH 3/6] add KaTeX support in figure caption
---
layouts/_default/_markup/render-image.html | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/layouts/_default/_markup/render-image.html b/layouts/_default/_markup/render-image.html
index df4f7f9..11cc775 100644
--- a/layouts/_default/_markup/render-image.html
+++ b/layouts/_default/_markup/render-image.html
@@ -1,7 +1,7 @@
{{- $image := .Page.Resources.GetMatch (printf "%s" (.Destination | safeURL)) -}}
{{- $Permalink := .Destination | relURL | safeURL -}}
{{- $alt := .PlainText | safeHTML -}}
-{{- $title := .Title | safeHTML -}}
+{{- $title := .Title | markdownify | safeHTML -}}
{{- $Width := 0 -}}
{{- $Height := 0 -}}
{{- $Srcset := "" -}}
@@ -41,5 +41,5 @@
{{ end }}
>
{{- if $title }}
-{{ .Title }}
+{{ .Title | markdownify }}
{{- end }}
From 40fc4c9a6313474acea5faf1e8cdd57f1ba9fd31 Mon Sep 17 00:00:00 2001
From: "Charles.Day" <47104966+AstroNomen@users.noreply.github.com>
Date: Tue, 24 Dec 2024 14:24:23 +0100
Subject: [PATCH 4/6] remove duplicate code
---
layouts/_default/_markup/render-image.html | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/layouts/_default/_markup/render-image.html b/layouts/_default/_markup/render-image.html
index 11cc775..f71eaa6 100644
--- a/layouts/_default/_markup/render-image.html
+++ b/layouts/_default/_markup/render-image.html
@@ -41,5 +41,5 @@
{{ end }}
>
{{- if $title }}
-{{ .Title | markdownify }}
+{{ .Title | }}
{{- end }}
From 2cef2105c846d1f006c2d014aa822da14d42da6d Mon Sep 17 00:00:00 2001
From: "Charles.Day" <47104966+AstroNomen@users.noreply.github.com>
Date: Tue, 24 Dec 2024 14:24:40 +0100
Subject: [PATCH 5/6] remove duplicate code
---
layouts/_default/_markup/render-image.html | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/layouts/_default/_markup/render-image.html b/layouts/_default/_markup/render-image.html
index f71eaa6..5a918ee 100644
--- a/layouts/_default/_markup/render-image.html
+++ b/layouts/_default/_markup/render-image.html
@@ -41,5 +41,5 @@
{{ end }}
>
{{- if $title }}
-{{ .Title | }}
+{{ .Title }}
{{- end }}
From 557aae81636d55c9047cabc9871c05a64974714d Mon Sep 17 00:00:00 2001
From: "Charles.Day" <47104966+AstroNomen@users.noreply.github.com>
Date: Tue, 24 Dec 2024 14:27:51 +0100
Subject: [PATCH 6/6] Update caption scss
---
assets/scss/partials/layout/article.scss | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/assets/scss/partials/layout/article.scss b/assets/scss/partials/layout/article.scss
index 5df3c72..ca80674 100644
--- a/assets/scss/partials/layout/article.scss
+++ b/assets/scss/partials/layout/article.scss
@@ -46,7 +46,7 @@
figcaption {
margin-top: 0.5em;
- font-size: 0.8em;
+ font-size: 0.9em;
color: var(--card-text-color-secondary);
font-style: italic;
font-weight: bold;