aboutsummaryrefslogtreecommitdiff
path: root/themes/default/layouts
diff options
context:
space:
mode:
authortdro <tdro@noreply.example.com>2023-12-18 20:33:06 -0500
committertdro <tdro@noreply.example.com>2023-12-18 20:33:06 -0500
commit82041d35b1bb1cd01b422327264acdd15418bee6 (patch)
tree195becfd8c4c9cbce58c3449f0de7d2a275d4d4e /themes/default/layouts
parentb4c3b3d8e84ded34b88d47b32302b509b50d419f (diff)
downloadcanory-82041d35b1bb1cd01b422327264acdd15418bee6.tar.gz
canory-82041d35b1bb1cd01b422327264acdd15418bee6.tar.bz2
canory-82041d35b1bb1cd01b422327264acdd15418bee6.zip
themes/default/layouts/_default/_markup/render-codeblock: Links content editable false
Diffstat (limited to 'themes/default/layouts')
-rw-r--r--themes/default/layouts/_default/_markup/render-codeblock.html18
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>