mirror of
https://github.com/nunocoracao/blowfish.git
synced 2026-01-30 16:31:52 +01:00
initial commit
This commit is contained in:
8
layouts/shortcodes/alert.html
Normal file
8
layouts/shortcodes/alert.html
Normal file
@@ -0,0 +1,8 @@
|
||||
<div class="flex px-4 py-3 rounded-md bg-primary-100 dark:bg-primary-900">
|
||||
<span class="text-primary-400 ltr:pr-3 rtl:pl-3">
|
||||
{{ partial "icon.html" (.Get 0 | default "triangle-exclamation") }}
|
||||
</span>
|
||||
<span class="dark:text-neutral-300">
|
||||
{{- .Inner | markdownify -}}
|
||||
</span>
|
||||
</div>
|
||||
1
layouts/shortcodes/badge.html
Normal file
1
layouts/shortcodes/badge.html
Normal file
@@ -0,0 +1 @@
|
||||
{{ partial "badge.html" .Inner }}
|
||||
8
layouts/shortcodes/button.html
Normal file
8
layouts/shortcodes/button.html
Normal file
@@ -0,0 +1,8 @@
|
||||
<a
|
||||
class="!rounded-md bg-primary-600 px-4 py-2 !text-neutral !no-underline hover:!bg-primary-500 dark:bg-primary-800 dark:hover:!bg-primary-700"
|
||||
{{ with .Get "href" }}href="{{ . }}"{{ end }}
|
||||
{{ with .Get "target" }}target="{{ . }}"{{ end }}
|
||||
role="button"
|
||||
>
|
||||
{{ .Inner }}
|
||||
</a>
|
||||
12
layouts/shortcodes/chart.html
Normal file
12
layouts/shortcodes/chart.html
Normal file
@@ -0,0 +1,12 @@
|
||||
<div class="chart">
|
||||
{{ $id := delimit (shuffle (seq 1 9)) "" }}
|
||||
<canvas id="{{ $id }}"></canvas>
|
||||
<script type="text/javascript">
|
||||
window.addEventListener("DOMContentLoaded", (event) => {
|
||||
const ctx = document.getElementById("{{ $id }}");
|
||||
const chart = new Chart(ctx, {
|
||||
{{ .Inner | safeJS }}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
44
layouts/shortcodes/figure.html
Normal file
44
layouts/shortcodes/figure.html
Normal file
@@ -0,0 +1,44 @@
|
||||
{{ if .Get "default" }}
|
||||
{{ template "_internal/shortcodes/figure.html" . }}
|
||||
{{ else }}
|
||||
{{ $url := urls.Parse (.Get "src") }}
|
||||
{{ $altText := .Get "alt" }}
|
||||
{{ $caption := .Get "caption" }}
|
||||
{{ $href := .Get "href" }}
|
||||
{{ $class := .Get "class" }}
|
||||
{{ if findRE "^https?" $url.Scheme }}
|
||||
<figure>
|
||||
<img class="my-0 rounded-md" src="{{ $url.String }}" alt="{{ $altText }}" />
|
||||
{{ with $caption }}<figcaption>{{ . | markdownify }}</figcaption>{{ end }}
|
||||
</figure>
|
||||
{{ else }}
|
||||
{{ $resource := "" }}
|
||||
{{ if $.Page.Resources.GetMatch ($url.String) }}
|
||||
{{ $resource = $.Page.Resources.GetMatch ($url.String) }}
|
||||
{{ else if resources.GetMatch ($url.String) }}
|
||||
{{ $resource = resources.Get ($url.String) }}
|
||||
{{ end }}
|
||||
{{ with $resource }}
|
||||
<figure {{ with $class }}class="{{ . }}"{{ end }}>
|
||||
{{ with $href }}<a href="{{ . }}">{{ end }}
|
||||
<img
|
||||
class="my-0 rounded-md"
|
||||
srcset="
|
||||
{{ (.Resize "330x").RelPermalink }} 330w,
|
||||
{{ (.Resize "660x").RelPermalink }} 660w,
|
||||
{{ (.Resize "1024x").RelPermalink }} 1024w,
|
||||
{{ (.Resize "1320x").RelPermalink }} 2x"
|
||||
src="{{ (.Resize "660x").RelPermalink }}"
|
||||
alt="{{ $altText }}"
|
||||
/>
|
||||
{{ if $href }}</a>{{ end }}
|
||||
{{ with $caption }}<figcaption>{{ . | markdownify }}</figcaption>{{ end }}
|
||||
</figure>
|
||||
{{ else }}
|
||||
<figure>
|
||||
<img class="my-0 rounded-md" src="{{ $url.String }}" alt="{{ $altText }}" />
|
||||
{{ with $caption }}<figcaption>{{ . | markdownify }}</figcaption>{{ end }}
|
||||
</figure>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
8
layouts/shortcodes/icon.html
Normal file
8
layouts/shortcodes/icon.html
Normal file
@@ -0,0 +1,8 @@
|
||||
{{ $icon := resources.Get (printf "icons/%s.svg" ($.Get 0)) }}
|
||||
{{ if $icon }}
|
||||
<span class="relative inline-block align-text-bottom icon">
|
||||
{{ $icon.Content | safeHTML }}
|
||||
</span>
|
||||
{{ else }}
|
||||
{{ errorf `[CONGO] Shortcode "icon" error in "%s": Resource "%s" not found. Check the path is correct or remove the shortcode.` .Page.Path (printf "icons/%s.svg" ($.Get 0)) }}
|
||||
{{ end }}
|
||||
1
layouts/shortcodes/katex.html
Normal file
1
layouts/shortcodes/katex.html
Normal file
@@ -0,0 +1 @@
|
||||
{{/* Nothing to see here */}}
|
||||
3
layouts/shortcodes/lead.html
Normal file
3
layouts/shortcodes/lead.html
Normal file
@@ -0,0 +1,3 @@
|
||||
<div class="lead !mb-9 text-xl">
|
||||
{{ .Inner | markdownify }}
|
||||
</div>
|
||||
3
layouts/shortcodes/mermaid.html
Normal file
3
layouts/shortcodes/mermaid.html
Normal file
@@ -0,0 +1,3 @@
|
||||
<div class="mermaid" align="center">
|
||||
{{ .Inner }}
|
||||
</div>
|
||||
22
layouts/shortcodes/screenshot.html
Normal file
22
layouts/shortcodes/screenshot.html
Normal file
@@ -0,0 +1,22 @@
|
||||
{{ if .Get "src" }}
|
||||
{{ $image := .Page.Resources.GetMatch (printf "*%s*" (.Get "src")) }}
|
||||
<figure{{ with .Get "class" }} class="{{ . }}"{{ end }}>
|
||||
{{- if .Get "href" -}}
|
||||
<a href="{{ .Get "href" }}">
|
||||
{{- end -}}
|
||||
<img src="{{ $image.RelPermalink }}"
|
||||
{{- if or (.Get "alt") (.Get "caption") }}
|
||||
alt="{{ with .Get "alt" }}{{ . }}{{ else }}{{ .Get "caption" | markdownify | plainify }}{{ end }}"
|
||||
{{- end -}}
|
||||
width="100%"
|
||||
height="auto"
|
||||
style="max-width:{{ div $image.Width 2 }}px; max-height:{{ div $image.Height 2 }}px;"
|
||||
/>
|
||||
{{- if .Get "href" }}</a>{{ end -}}
|
||||
{{- if .Get "caption" -}}
|
||||
<figcaption>
|
||||
{{- .Get "caption" | markdownify -}}
|
||||
</figcaption>
|
||||
{{- end }}
|
||||
</figure>
|
||||
{{ end }}
|
||||
Reference in New Issue
Block a user