feat: codeblock improvements (#1328)
* fix: do not show codeblock copy button if clipboard api is not available related: https://github.com/CaiJimmy/hugo-theme-stack/issues/1309 * fix: remove duplicated codeblock script in main.ts * feat: add i18n support to codeblock copy button * feat: add translation strings for codeblock copy button
This commit is contained in:
@@ -1,4 +1,12 @@
|
||||
{{- $opts := dict "minify" hugo.IsProduction -}}
|
||||
{{- $opts := dict
|
||||
"minify" hugo.IsProduction
|
||||
"params" (dict
|
||||
"codeblock" (dict
|
||||
"copy" (i18n "article.codeblock.copy")
|
||||
"copied" (i18n "article.codeblock.copied")
|
||||
)
|
||||
)
|
||||
-}}
|
||||
{{- $script := resources.Get "ts/main.ts" | js.Build $opts | fingerprint -}}
|
||||
|
||||
<script type="text/javascript" src="{{ $script.RelPermalink }}" defer></script>
|
||||
@@ -7,4 +15,4 @@
|
||||
{{/* Place your custom script in HUGO_SITE_FOLDER/assets/ts/custom.ts */}}
|
||||
{{- $customScript := . | js.Build $opts | fingerprint -}}
|
||||
<script type="text/javascript" src="{{ $customScript.RelPermalink }}" defer></script>
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
Reference in New Issue
Block a user