From 5ca1c4c5f00ece5f431bb0f1f46442a371a42b20 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B6ren=20Weber?= Date: Mon, 5 Jun 2023 00:24:14 +0200 Subject: [PATCH] shortcodes: avoid superflous margin at start and end of content #558 --- layouts/partials/shortcodes/expand.html | 1 + layouts/partials/shortcodes/notice.html | 1 + layouts/partials/shortcodes/tabs.html | 1 + static/css/theme.css | 8 ++++++-- 4 files changed, 9 insertions(+), 2 deletions(-) diff --git a/layouts/partials/shortcodes/expand.html b/layouts/partials/shortcodes/expand.html index cbf1fc117b..3b30bd2fe0 100644 --- a/layouts/partials/shortcodes/expand.html +++ b/layouts/partials/shortcodes/expand.html @@ -16,6 +16,7 @@ {{ $title | .RenderString }}
+{{ if ne "<" (substr (strings.TrimLeft " " $content) 0 1) }}

{{ end }} {{ $content | safeHTML }}

{{- end }} \ No newline at end of file diff --git a/layouts/partials/shortcodes/notice.html b/layouts/partials/shortcodes/notice.html index 7a49182aa0..5bacde9cc7 100644 --- a/layouts/partials/shortcodes/notice.html +++ b/layouts/partials/shortcodes/notice.html @@ -19,6 +19,7 @@
{{ if $icon }}{{ end }}{{ if and $icon $title }} {{ end }}{{ $title | .RenderString }}
+{{ if ne "<" (substr (strings.TrimLeft " " $content) 0 1) }}

{{ end }} {{ $content | safeHTML }}

{{- end }} \ No newline at end of file diff --git a/layouts/partials/shortcodes/tabs.html b/layouts/partials/shortcodes/tabs.html index 9e936f351a..f356ac46f7 100644 --- a/layouts/partials/shortcodes/tabs.html +++ b/layouts/partials/shortcodes/tabs.html @@ -19,6 +19,7 @@ data-tab-item="{{ .name | $context.RenderString | plainify }}" class="tab-content-text{{ cond (eq $idx 0) " active" ""}}" > +{{ if ne "<" (substr (strings.TrimLeft " " .content) 0 1) }}

{{ end }} {{ .content | safeHTML }} {{- end }} diff --git a/static/css/theme.css b/static/css/theme.css index d4342384cb..3769509856 100644 --- a/static/css/theme.css +++ b/static/css/theme.css @@ -444,7 +444,9 @@ div.box > .box-content { #body table td > :first-child, #body table td > :first-child :first-child, #body div.box > .box-content > :first-child, -#body div.box > .box-content > :first-child :first-child { +#body div.box > .box-content > :first-child :first-child, +#body div.tab-content > .tab-content-text > :first-child, +#body div.tab-content > .tab-content-text > :first-child :first-child { margin-top: 0; } @@ -453,7 +455,9 @@ div.box > .box-content { #body table td > :last-child, #body table td > :last-child :last-child, #body div.box > .box-content > :last-child, -#body div.box > .box-content > :last-child :last-child { +#body div.box > .box-content > :last-child :last-child, +#body div.tab-content > .tab-content-text > :last-child, +#body div.tab-content > .tab-content-text > :last-child :last-child { margin-bottom: 0; }