aboutsummaryrefslogtreecommitdiff
path: root/themes/default/layouts/_default/_markup/render-codeblock.html
diff options
context:
space:
mode:
authortdro <tdro@noreply.example.com>2022-07-14 10:14:59 -0400
committertdro <tdro@noreply.example.com>2022-07-14 10:14:59 -0400
commit5d381dc1e70a28828bfbab759d5ffc83e93527eb (patch)
tree82ed3fe295cb9b033c79354adb4347ba09c5c5e3 /themes/default/layouts/_default/_markup/render-codeblock.html
parent06feec0c2082adcdd63ff430f64cb5beef26b0f3 (diff)
downloadcanory-5d381dc1e70a28828bfbab759d5ffc83e93527eb.tar.gz
canory-5d381dc1e70a28828bfbab759d5ffc83e93527eb.tar.bz2
canory-5d381dc1e70a28828bfbab759d5ffc83e93527eb.zip
assets/css/syntax-highlight-default: Add block code targets
Set default type.
Diffstat (limited to 'themes/default/layouts/_default/_markup/render-codeblock.html')
-rw-r--r--themes/default/layouts/_default/_markup/render-codeblock.html12
1 files changed, 7 insertions, 5 deletions
diff --git a/themes/default/layouts/_default/_markup/render-codeblock.html b/themes/default/layouts/_default/_markup/render-codeblock.html
index 7c2670f..8bc484b 100644
--- a/themes/default/layouts/_default/_markup/render-codeblock.html
+++ b/themes/default/layouts/_default/_markup/render-codeblock.html
@@ -1,17 +1,19 @@
-{{ $options := .Attributes.options | default "default=1" }}
-{{ $caption := .Attributes.caption }}
+{{- $caption := .Attributes.caption -}}
+{{- $type := .Type | default "text" -}}
+{{- $options := .Attributes.options | default "default=1" -}}
+{{- $id := print "code-block-" (truncate 7 "" (md5 .Inner)) -}}
-<code-block {{ if in (lower $options) "linenos" }}data-lines{{ end }}>
+<code-block id="{{ $id }}" {{ if in (lower $options) "linenos" }}data-lines{{ end }}>
<header>
<language-label>
- {{ .Type }}
+ <a href="#{{ $id }}">{{ $type }}</a>
</language-label>
<button>
{{ safeHTML (readFile (print (partial "function-paths.html" "static") "/icons/feather/copy.svg")) }}
<span>Copy</span>
</button>
</header>
- {{ highlight .Inner .Type (print $options ",lineAnchors=" "code-" (truncate 7 "" (md5 .Inner))) }}
+ {{ highlight .Inner $type (print $options ",lineAnchors=" "code-line-" (truncate 7 "" (md5 .Inner))) }}
</code-block>
{{ with $caption }}