the home site for me: also iteration 3 or 4 of my site
at main 3.0 kB view raw
1{%- set type = type | default(value="info") | lower -%} 2{%- set title = title | default(value="") -%} 3 4{%- if type == "info" -%} 5 {%- 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>' -%} 6 {%- set color = "blue" -%} 7 {%- set default_title = "Info" -%} 8{%- elif type == "warning" or type == "warn" -%} 9 {%- 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>' -%} 10 {%- set color = "yellow" -%} 11 {%- set default_title = "Warning" -%} 12{%- elif type == "danger" or type == "error" -%} 13 {%- 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>' -%} 14 {%- set color = "red" -%} 15 {%- set default_title = "Danger" -%} 16{%- elif type == "tip" or type == "hint" -%} 17 {%- 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>' -%} 18 {%- set color = "green" -%} 19 {%- set default_title = "Tip" -%} 20{%- elif type == "note" -%} 21 {%- 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>' -%} 22 {%- set color = "gray" -%} 23 {%- set default_title = "Note" -%} 24{%- else -%} 25 {%- 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>' -%} 26 {%- set color = "blue" -%} 27 {%- set default_title = "Info" -%} 28{%- endif -%} 29 30{%- if title == "" -%} 31 {%- set title = default_title -%} 32{%- endif -%} 33 34<div class="callout callout-{{ color }}"> 35 <div class="callout-title"> 36 <span class="callout-icon">{{ icon | safe }}</span> 37 <strong>{{ title }}</strong> 38 </div> 39 <div class="callout-content"> 40 {{ body | markdown | safe }} 41 </div> 42</div>