aboutsummaryrefslogtreecommitdiff
path: root/generators/hugo/themes/tdro/layouts/_default/_markup/render-codeblock.html
diff options
context:
space:
mode:
Diffstat (limited to 'generators/hugo/themes/tdro/layouts/_default/_markup/render-codeblock.html')
-rw-r--r--generators/hugo/themes/tdro/layouts/_default/_markup/render-codeblock.html17
1 files changed, 17 insertions, 0 deletions
diff --git a/generators/hugo/themes/tdro/layouts/_default/_markup/render-codeblock.html b/generators/hugo/themes/tdro/layouts/_default/_markup/render-codeblock.html
new file mode 100644
index 0000000..7541268
--- /dev/null
+++ b/generators/hugo/themes/tdro/layouts/_default/_markup/render-codeblock.html
@@ -0,0 +1,17 @@
+{{- $caption := .Attributes.caption -}}
+{{- $type := .Type | default "text" -}}
+{{- $options := .Attributes.options | default "default=1" -}}
+{{- $id := print "code-block-" (truncate 7 "" (md5 .Inner)) -}}
+
+<code-block id="{{ $id }}" {{ if in (lower $options) "linenos" }}data-lines{{ end }}>
+ <header>
+ <language-label>
+ <a href="#{{ $id }}"><code>{{ $type }}</code></a>
+ </language-label>
+ </header>
+ {{ highlight .Inner $type (print $options ",lineAnchors=" "code-line-" (truncate 7 "" (md5 .Inner))) }}
+</code-block>
+
+{{- with $caption -}}
+ <footer>{{- . | markdownify -}}</footer>
+{{- end -}}