feat(code): remember the selected language of the code toggle

This commit is contained in:
Cell
2026-03-21 00:47:12 +08:00
parent d9e45154ff
commit d5aa013106
3 changed files with 18 additions and 6 deletions
+1 -1
View File
@@ -55,7 +55,7 @@
{{- $active := cond (eq $format $activeFormat) ", .active" "" -}}
{{- $jsonViewer := cond (eq $format "json") ", enable=false" "" -}}
{{- $labelName := cond (ne $.Attributes.before_tabs nil) $format (upper $format) -}}
{{- $block := printf "```%s {name=%q%s%s%s}\n%s\n```\n\n" $format $labelName $active $jsonViewer $commonAttrsStr $content -}}
{{- $block := printf "```%s {data-code-toggle=true, name=%q%s%s%s}\n%s\n```\n\n" $format $labelName $active $jsonViewer $commonAttrsStr $content -}}
{{- $renderText = add $renderText $block -}}
{{- end -}}
{{- $renderText | .Page.RenderString -}}