diff options
author | tdro <tdro@noreply.example.com> | 2023-12-18 20:33:06 -0500 |
---|---|---|
committer | tdro <tdro@noreply.example.com> | 2023-12-18 20:33:06 -0500 |
commit | 82041d35b1bb1cd01b422327264acdd15418bee6 (patch) | |
tree | 195becfd8c4c9cbce58c3449f0de7d2a275d4d4e | |
parent | b4c3b3d8e84ded34b88d47b32302b509b50d419f (diff) | |
download | canory-82041d35b1bb1cd01b422327264acdd15418bee6.tar.gz canory-82041d35b1bb1cd01b422327264acdd15418bee6.tar.bz2 canory-82041d35b1bb1cd01b422327264acdd15418bee6.zip |
themes/default/layouts/_default/_markup/render-codeblock: Links content editable false
-rw-r--r-- | themes/default/layouts/_default/_markup/render-codeblock.html | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/themes/default/layouts/_default/_markup/render-codeblock.html b/themes/default/layouts/_default/_markup/render-codeblock.html index 91ee9f6..ab9a786 100644 --- a/themes/default/layouts/_default/_markup/render-codeblock.html +++ b/themes/default/layouts/_default/_markup/render-codeblock.html @@ -1,9 +1,9 @@ -{{- $caption := .Attributes.caption -}} -{{- $type := .Type | default "text" -}} -{{- $options := .Attributes.options | default "default=1" -}} -{{- $hash := print (truncate 3 "" (sha256 .Inner)) (truncate 3 "" (sha256 .Page.RelPermalink)) .Ordinal -}} -{{- $id := print "code-block:" $hash | safeURL -}} -{{- $edit := "false" -}} +{{- $caption := .Attributes.caption -}} +{{- $type := .Type | default "text" -}} +{{- $options := .Attributes.options | default "default=1" -}} +{{- $hash := print (truncate 3 "" (sha256 .Inner)) (truncate 3 "" (sha256 .Page.RelPermalink)) .Ordinal -}} +{{- $id := print "code-block:" $hash | safeURL -}} +{{- $highlight := highlight .Inner $type (print $options ",lineAnchors=" "code-line:" $hash) -}} <code-block id="{{ $id }}" {{ if in (lower $options) "linenos" }}data-lines=""{{ end }}> <header> @@ -12,7 +12,11 @@ </language-label> </header> <code-content contenteditable="true" spellcheck="false"> - {{- highlight .Inner $type (print $options ",lineAnchors=" "code-line:" $hash) -}} + {{- replace $highlight + `class="lnlinks"` + `contenteditable="false" class="lnlinks"` + | safeHTML + -}} </code-content> </code-block> |