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.html5
1 files changed, 3 insertions, 2 deletions
diff --git a/themes/default/layouts/_default/_markup/render-codeblock.html b/themes/default/layouts/_default/_markup/render-codeblock.html
index 22d47e4..d629a85 100644
--- a/themes/default/layouts/_default/_markup/render-codeblock.html
+++ b/themes/default/layouts/_default/_markup/render-codeblock.html
@@ -1,7 +1,8 @@
{{- $caption := .Attributes.caption -}}
{{- $type := .Type | default "text" -}}
{{- $options := .Attributes.options | default "default=1" -}}
-{{- $id := print "code-block-" (truncate 7 "" (md5 .Inner)) -}}
+{{- $hash := print (truncate 8 "" (sha256 .Inner)) .Ordinal -}}
+{{- $id := print "code-block-" $hash -}}
<code-block id="{{ $id }}" {{ if in (lower $options) "linenos" }}data-lines{{ end }}>
<header>
@@ -13,7 +14,7 @@
<span>Copy</span>
</button>
</header>
- {{ highlight .Inner $type (print $options ",lineAnchors=" "code-line-" (truncate 7 "" (md5 .Inner))) }}
+ {{ highlight .Inner $type (print $options ",lineAnchors=" "code-line-" $hash) }}
</code-block>
{{ with $caption }}