++ + +{{/* Render a different block, if "loud" callouts are used */}} +{{ $specialTitles := slice "Caution" "Warning" "Deprecated" "Important" }} +{{ $isSpecialTitle := in $specialTitles $title }} +{{ if $isSpecialTitle }} + {{/* Loud callouts */}} + + +{{ else }} + +{{/* "Generic" mf callout */}} + +{{ $cleanTitle := strings.TrimSuffix ":" $title}} + + + +{{ end }} \ No newline at end of file diff --git a/layouts/shortcodes/before-you-begin.html b/layouts/shortcodes/before-you-begin.html index cd947956..e3c14fba 100644 --- a/layouts/shortcodes/before-you-begin.html +++ b/layouts/shortcodes/before-you-begin.html @@ -1,3 +1,8 @@ -+ {{ with $icon }} + + {{ end }} + {{ $title }} + {{ .content | markdownify }} ++
-\ No newline at end of file + {{ partial "callout.html" (dict + "class" "tip" + "title" "Before you begin:" + "icon" "" + "inline" "false" + "content" .Inner +) }} +{{ warnf "'Before you begin:-
{{ .Inner | markdownify }}
-\ No newline at end of file +{{ partial "callout.html" (dict + "class" $class + "title" $title + "icon" $icon + "inline" $inline + "content" .Inner +) }} \ No newline at end of file diff --git a/layouts/shortcodes/caution.html b/layouts/shortcodes/caution.html index 7aff8c24..866fba3b 100644 --- a/layouts/shortcodes/caution.html +++ b/layouts/shortcodes/caution.html @@ -1,3 +1,7 @@ -- - {{ with .Get 2 }} - - - {{ end }} - - {{ .Get 1 }}-
- - {{ .Inner | markdownify }} -
-\ No newline at end of file +{{ partial "callout.html" (dict +"class" "caution call-out" +"title" "Caution" +"icon" "" +"inline" "false" +"content" .Inner +) }} \ No newline at end of file diff --git a/layouts/shortcodes/deprecated.html b/layouts/shortcodes/deprecated.html index 9fcd7204..512092d5 100644 --- a/layouts/shortcodes/deprecated.html +++ b/layouts/shortcodes/deprecated.html @@ -1,3 +1,7 @@ -Caution-
{{ .Inner | markdownify }}
-\ No newline at end of file +{{ partial "callout.html" (dict +"class" "warning call-out" +"title" "Deprecated" +"icon" "" +"inline" "false" +"content" .Inner +) }} \ No newline at end of file diff --git a/layouts/shortcodes/important.html b/layouts/shortcodes/important.html index 55f6ade8..ee48cd7b 100644 --- a/layouts/shortcodes/important.html +++ b/layouts/shortcodes/important.html @@ -1,3 +1,7 @@ -Deprecated-
{{ .Inner | markdownify }}
-+{{ partial "callout.html" (dict +"class" "important call-out" +"title" "Important" +"icon" "" +"inline" "false" +"content" .Inner +) }} \ No newline at end of file diff --git a/layouts/shortcodes/note.html b/layouts/shortcodes/note.html index 95b0ebf2..08f1209d 100644 --- a/layouts/shortcodes/note.html +++ b/layouts/shortcodes/note.html @@ -1,3 +1,8 @@ -Important-
{{ .Inner | markdownify }}
-+{{ partial "callout.html" (dict +"class" "note" +"title" "Note:" +"icon" "" +"inline" "false" +"content" .Inner +) }} +{{ warnf "'Note:-
{{ .Inner | markdownify }}
-+{{ partial "callout.html" (dict +"class" "tip" +"title" "See Also:" +"icon" "" +"inline" "false" +"content" .Inner +) }} +{{ warnf "'See Also:-
{{ .Inner | markdownify }}
-+{{ partial "callout.html" (dict +"class" "tip" +"title" "Tip:" +"icon" "" +"inline" "false" +"content" .Inner +) }} +{{ warnf "'Tip:-
{{ .Inner | markdownify }}
-+{{ partial "callout.html" (dict +"class" "warning call-out" +"title" "Warning" +"icon" "" +"inline" "false" +"content" .Inner +) }} \ No newline at end of file From dd8067244d61968667912177605ae1afec7b6f2b Mon Sep 17 00:00:00 2001 From: Jack Hickey <133868041+nginx-jack@users.noreply.github.com> Date: Wed, 16 Apr 2025 14:18:38 +0100 Subject: [PATCH 2/2] Callout: Add feather support to mf loud callouts --- assets/css/v2/style.css | 20 ++++++++++++++++---- layouts/partials/callout.html | 20 +++++++++++++++----- layouts/shortcodes/call-out.html | 2 +- 3 files changed, 32 insertions(+), 10 deletions(-) diff --git a/assets/css/v2/style.css b/assets/css/v2/style.css index c036f9ba..2df9d531 100644 --- a/assets/css/v2/style.css +++ b/assets/css/v2/style.css @@ -1083,6 +1083,10 @@ blockquote { /* Removes negative margins from multi-line codeblocks */ margin: 0; } + + .callout-content { + margin: 0; + } } blockquote.note { @@ -1134,14 +1138,16 @@ li > blockquote { } blockquote.call-out { - padding: 0.5rem; + --padding: 0.75rem; + padding: var(--padding); .call-out-type { display: block; - padding: 0.25rem 0.5rem; - margin: -0.5rem 0 0.5rem -0.5rem; - width: calc(100% + 1rem); font-weight: 500; + margin: calc(-1 * var(--padding)) calc(-1 * var(--padding)) var(--padding) + calc(-1 * var(--padding)); + + padding: 0.25rem var(--padding); } br { @@ -1157,6 +1163,9 @@ blockquote.caution { background-color: oklch(var(--color-callout-caution-shadow)); border-bottom: 1px solid oklch(var(--color-callout-caution-primary)); } + .call-out-type .feather { + color: oklch(var(--color-callout-caution-primary)); + } } blockquote.warning { @@ -1167,6 +1176,9 @@ blockquote.warning { background-color: oklch(var(--color-callout-warning-shadow)); border-bottom: 1px solid oklch(var(--color-callout-warning-primary)); } + .call-out-type .feather { + color: oklch(var(--color-callout-warning-primary)); + } } blockquote.important { diff --git a/layouts/partials/callout.html b/layouts/partials/callout.html index 23192fb3..9cb4796f 100644 --- a/layouts/partials/callout.html +++ b/layouts/partials/callout.html @@ -35,22 +35,30 @@ {{/* Render a different block, if "loud" callouts are used */}} {{ $specialTitles := slice "Caution" "Warning" "Deprecated" "Important" }} +{{ $specialTitleIcons := dict + "Caution" "alert-triangle" + "Warning" "alert-octagon" + "Deprecated" "alert-octagon" + "Important" "arrow-right-circle" +}} +{{ $icon := index $specialTitleIcons $title | default "" }} + {{ $isSpecialTitle := in $specialTitles $title }} {{ if $isSpecialTitle }} {{/* Loud callouts */}} +Warning-
{{ .Inner | markdownify }}