summaryrefslogtreecommitdiffstats
path: root/themes/danix-xyz-hacker/layouts/_default/_markup/render-codeblock.html
diff options
context:
space:
mode:
Diffstat (limited to 'themes/danix-xyz-hacker/layouts/_default/_markup/render-codeblock.html')
-rw-r--r--themes/danix-xyz-hacker/layouts/_default/_markup/render-codeblock.html23
1 files changed, 23 insertions, 0 deletions
diff --git a/themes/danix-xyz-hacker/layouts/_default/_markup/render-codeblock.html b/themes/danix-xyz-hacker/layouts/_default/_markup/render-codeblock.html
new file mode 100644
index 0000000..813c389
--- /dev/null
+++ b/themes/danix-xyz-hacker/layouts/_default/_markup/render-codeblock.html
@@ -0,0 +1,23 @@
+{{- $lang := .Type -}}
+{{- $hasLang := gt (len $lang) 0 -}}
+{{- $highlightLang := $lang -}}
+{{- if not $hasLang -}}{{- $highlightLang = "text" -}}{{- end -}}
+{{- $opts := dict "lineNos" true "lineNumbersInTable" true -}}
+
+<div class="code-block-wrapper">
+ {{- if $hasLang -}}
+ <div class="code-header" data-lang="{{ $lang }}">
+ <span class="code-lang-label">{{ $lang }}</span>
+ <div class="code-copy-wrapper">
+ <span role="status" aria-live="polite" class="sr-only code-copy-status"></span>
+ <button class="code-copy-btn" aria-label="Copy code" data-copy-target>
+ <i data-feather="copy" aria-hidden="true"></i>
+ <i data-feather="check" aria-hidden="true" class="hidden"></i>
+ </button>
+ </div>
+ </div>
+ {{- end -}}
+ <div class="code-body">
+ {{ highlight .Inner $highlightLang $opts }}
+ </div>
+</div>