the home site for me: also iteration 3 or 4 of my site

feat: add callouts

dunkirk.sh 8298475e 2a80f3e8

verified
Changed files
+125
sass
css
templates
shortcodes
+83
sass/css/suCSS.css
···
font-style: italic;
}
+
/* Callout styles */
+
.callout {
+
margin: 1.5rem 0;
+
padding: 1rem;
+
border-left: 0.25rem solid;
+
border-radius: 0.25rem;
+
background-color: var(--bg-light);
+
}
+
+
.callout-title {
+
display: flex;
+
align-items: center;
+
gap: 0.5rem;
+
margin-bottom: 0.5rem;
+
font-size: 1rem;
+
}
+
+
.callout-icon {
+
display: inline-flex;
+
width: 1.25rem;
+
height: 1.25rem;
+
flex-shrink: 0;
+
}
+
+
.callout-icon svg {
+
width: 100%;
+
height: 100%;
+
}
+
+
.callout-content {
+
font-style: normal;
+
color: var(--text);
+
}
+
+
.callout-content p:first-child {
+
margin-top: 0;
+
}
+
+
.callout-content p:last-child {
+
margin-bottom: 0;
+
}
+
+
.callout-blue {
+
border-color: #8aadf4;
+
}
+
+
.callout-blue .callout-icon {
+
color: #8aadf4;
+
}
+
+
.callout-yellow {
+
border-color: #eed49f;
+
}
+
+
.callout-yellow .callout-icon {
+
color: #eed49f;
+
}
+
+
.callout-red {
+
border-color: #ed8796;
+
}
+
+
.callout-red .callout-icon {
+
color: #ed8796;
+
}
+
+
.callout-green {
+
border-color: #a6da95;
+
}
+
+
.callout-green .callout-icon {
+
color: #a6da95;
+
}
+
+
.callout-gray {
+
border-color: #6e738d;
+
}
+
+
.callout-gray .callout-icon {
+
color: #6e738d;
+
}
+
+
p:has(cite) {
text-align: right;
font-size: 0.875rem;
+42
templates/shortcodes/callout.html
···
+
{%- set type = type | default(value="info") | lower -%}
+
{%- set title = title | default(value="") -%}
+
+
{%- if type == "info" -%}
+
{%- set icon = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"></circle><line x1="12" y1="16" x2="12" y2="12"></line><line x1="12" y1="8" x2="12.01" y2="8"></line></svg>' -%}
+
{%- set color = "blue" -%}
+
{%- set default_title = "Info" -%}
+
{%- elif type == "warning" or type == "warn" -%}
+
{%- set icon = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3Z"></path><line x1="12" y1="9" x2="12" y2="13"></line><line x1="12" y1="17" x2="12.01" y2="17"></line></svg>' -%}
+
{%- set color = "yellow" -%}
+
{%- set default_title = "Warning" -%}
+
{%- elif type == "danger" or type == "error" -%}
+
{%- set icon = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"></circle><line x1="15" y1="9" x2="9" y2="15"></line><line x1="9" y1="9" x2="15" y2="15"></line></svg>' -%}
+
{%- set color = "red" -%}
+
{%- set default_title = "Danger" -%}
+
{%- elif type == "tip" or type == "hint" -%}
+
{%- set icon = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5"></path><path d="M9 18h6"></path><path d="M10 22h4"></path></svg>' -%}
+
{%- set color = "green" -%}
+
{%- set default_title = "Tip" -%}
+
{%- elif type == "note" -%}
+
{%- set icon = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M12 20h9"></path><path d="M16.5 3.5a2.12 2.12 0 0 1 3 3L7 19l-4 1 1-4Z"></path></svg>' -%}
+
{%- set color = "gray" -%}
+
{%- set default_title = "Note" -%}
+
{%- else -%}
+
{%- set icon = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"></circle><line x1="12" y1="16" x2="12" y2="12"></line><line x1="12" y1="8" x2="12.01" y2="8"></line></svg>' -%}
+
{%- set color = "blue" -%}
+
{%- set default_title = "Info" -%}
+
{%- endif -%}
+
+
{%- if title == "" -%}
+
{%- set title = default_title -%}
+
{%- endif -%}
+
+
<div class="callout callout-{{ color }}">
+
<div class="callout-title">
+
<span class="callout-icon">{{ icon | safe }}</span>
+
<strong>{{ title }}</strong>
+
</div>
+
<div class="callout-content">
+
{{ body | markdown | safe }}
+
</div>
+
</div>