aboutsummaryrefslogtreecommitdiff
path: root/themes/default/layouts/_default/_markup/render-codeblock.html
diff options
context:
space:
mode:
Diffstat (limited to 'themes/default/layouts/_default/_markup/render-codeblock.html')
-rw-r--r--themes/default/layouts/_default/_markup/render-codeblock.html19
1 files changed, 19 insertions, 0 deletions
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 }}