aboutsummaryrefslogtreecommitdiff
path: root/themes/default/layouts/_default/_markup
diff options
context:
space:
mode:
authortdro <tdro@noreply.example.com>2022-05-03 04:25:49 -0400
committertdro <tdro@noreply.example.com>2022-05-03 04:25:49 -0400
commite92dc018e28ba8d44f1c6cbc9fb0b779dec271e6 (patch)
tree3667043819ab91065019dfe3b4ff83ad625c2b49 /themes/default/layouts/_default/_markup
downloadcanory-e92dc018e28ba8d44f1c6cbc9fb0b779dec271e6.tar.gz
canory-e92dc018e28ba8d44f1c6cbc9fb0b779dec271e6.tar.bz2
canory-e92dc018e28ba8d44f1c6cbc9fb0b779dec271e6.zip
config.yaml: Commission
Diffstat (limited to 'themes/default/layouts/_default/_markup')
-rw-r--r--themes/default/layouts/_default/_markup/render-codeblock-goat.html19
-rw-r--r--themes/default/layouts/_default/_markup/render-codeblock.html19
-rw-r--r--themes/default/layouts/_default/_markup/render-heading.html6
-rw-r--r--themes/default/layouts/_default/_markup/render-image.html45
-rw-r--r--themes/default/layouts/_default/_markup/render-link.html21
5 files changed, 110 insertions, 0 deletions
diff --git a/themes/default/layouts/_default/_markup/render-codeblock-goat.html b/themes/default/layouts/_default/_markup/render-codeblock-goat.html
new file mode 100644
index 0000000..e83d7de
--- /dev/null
+++ b/themes/default/layouts/_default/_markup/render-codeblock-goat.html
@@ -0,0 +1,19 @@
+{{ $width := .Attributes.width }}
+{{ $height := .Attributes.height }}
+{{ $caption := default "GoAT Diagram" .Attributes.caption }}
+
+<diagram-container>
+ {{ with diagrams.Goat .Inner }}
+ <svg
+ xmlns="http://www.w3.org/2000/svg"
+ {{ if or $width $height }}
+ {{ with $width }}width="{{ . }}"{{ end }}
+ {{ with $height }}height="{{ . }}"{{ end }}
+ {{ else }}
+ viewBox="0 0 {{ .Width }} {{ .Height }}"
+ {{ end }}>
+ {{ .Inner }}
+ </svg>
+ {{ end }}
+ <figcaption>{{ $caption | markdownify }}</figcaption>
+</diagram-container>
diff --git a/themes/default/layouts/_default/_markup/render-codeblock.html b/themes/default/layouts/_default/_markup/render-codeblock.html
new file mode 100644
index 0000000..9dba950
--- /dev/null
+++ b/themes/default/layouts/_default/_markup/render-codeblock.html
@@ -0,0 +1,19 @@
+{{ $options := .Attributes.options | default "default=1" }}
+{{ $caption := .Attributes.caption }}
+
+<code-block {{ if in (lower $options) "linenos" }}data-lines{{ end }}>
+ <header>
+ <language-label>
+ {{ .Type }}
+ </language-label>
+ <button>
+ {{ safeHTML (readFile "static/icons/feather/copy.svg") }}
+ <span>Copy</span>
+ </button>
+ </header>
+ {{ highlight .Inner .Type (print $options ",lineAnchors=" "code-" (truncate 7 "" (md5 .Inner))) }}
+</code-block>
+
+{{ with $caption }}
+ <figcaption>{{ . | markdownify }}</figcaption>
+{{ end }}
diff --git a/themes/default/layouts/_default/_markup/render-heading.html b/themes/default/layouts/_default/_markup/render-heading.html
new file mode 100644
index 0000000..37eddb2
--- /dev/null
+++ b/themes/default/layouts/_default/_markup/render-heading.html
@@ -0,0 +1,6 @@
+<h{{ .Level }} id="{{ .Anchor | safeURL }}">
+ <a
+ title="{{ .Text | safeHTML }}"
+ href="#{{ .Anchor | safeURL }}">{{ .Text | safeHTML }}
+ </a>
+</h{{ .Level }}>
diff --git a/themes/default/layouts/_default/_markup/render-image.html b/themes/default/layouts/_default/_markup/render-image.html
new file mode 100644
index 0000000..00f37cf
--- /dev/null
+++ b/themes/default/layouts/_default/_markup/render-image.html
@@ -0,0 +1,45 @@
+{{- $source := $.Destination | safeURL -}}
+{{- $localPath := print "content/" $source -}}
+{{- $remoteImage := resources.GetRemote $source -}}
+{{- $width := "" -}}
+{{- $height := "" -}}
+
+{{- with $remoteImage -}}
+ {{- with .Err -}}
+ {{- if fileExists $localPath -}}
+ {{- $localImage := imageConfig $localPath -}}
+ {{- with $localImage -}}
+ {{- $width = .Width -}}
+ {{- $height = .Height -}}
+ {{- end -}}
+ {{- else -}}
+ {{- $source = print "/images/404.png" -}}
+ {{- $localPath = print "static/" $source -}}
+ {{- $localImage := imageConfig $localPath -}}
+ {{- with $localImage -}}
+ {{- $width = .Width -}}
+ {{- $height = .Height -}}
+ {{- end -}}
+ {{- end -}}
+ {{- else -}}
+ {{- $width = .Width -}}
+ {{- $height = .Height -}}
+ {{ end }}
+{{ end }}
+
+{{- /* This comment removes trailing newlines and white spaces. */ -}}
+<figure>
+ <a href="{{ $source }}">
+ <img loading="lazy"
+ src="{{ $source }}"
+ alt="{{ $.Text | htmlUnescape }}"
+ title="{{ $.Text | htmlUnescape }}"
+ width="{{ $width }}"
+ height="{{ $height }}"
+ />
+ </a>
+{{ if $.Title }}
+ <figcaption>{{ $.Title | markdownify }}</figcaption>
+{{ end -}}
+</figure>
+{{- /* This comment removes trailing newlines and white spaces. */ -}}
diff --git a/themes/default/layouts/_default/_markup/render-link.html b/themes/default/layouts/_default/_markup/render-link.html
new file mode 100644
index 0000000..9b1ffae
--- /dev/null
+++ b/themes/default/layouts/_default/_markup/render-link.html
@@ -0,0 +1,21 @@
+{{- $link := .Destination -}}
+{{ $isRemote := strings.HasPrefix $link "http" }}
+{{- if not $isRemote -}}
+{{ $url := urls.Parse .Destination }}
+{{- if $url.Path -}}
+{{ $fragment := "" }}
+{{- with $url.Fragment }}{{ $fragment = printf "#%s" . }}{{ end -}}
+{{- with .Page.GetPage $url.Path }}{{ $link = printf "%s%s" .RelPermalink $fragment }}{{ end }}{{ end -}}
+{{- end -}}
+<a
+ rel="noopener"
+ href="{{ $link | safeURL }}"
+ {{ with or .Title ($link | safeURL) -}}
+ title="{{ . }}"
+ {{ end }}
+ {{- if $isRemote -}}
+ target="_blank"
+ {{ end }}>
+ {{- .Text | safeHTML -}}
+</a>
+{{- /* This comment removes trailing newlines and white spaces. */ -}}