{{- /* Code block wrapper hook for highlight output. - Applies wrapper UI features based on codeblock config. - Supports classic/modern modes, copy button, expand button, and line-number states. @param {Object} .Attributes code block attributes @param {Object} .Options code fence options @param {String} .Inner raw code content @param {Object} .Page current page context @param {String} .Type language/type for current block */ -}} {{- $config := .Attributes | merge .Page.Params.codeblock | merge .Page.Site.Params.codeblock -}} {{- $result := transform.HighlightCodeBlock . -}} {{- $wrapper := $result.Wrapped -}} {{- /* If wrapper is enabled, add code wrapper and more features */ -}} {{- if $config.wrapper -}} {{- $mode := $config.mode | default "classic" -}} {{- $lines := cond .Inner (len (split .Inner "\n")) 0 -}} {{- $maxShownLines := $config.maxshownlines -}} {{- $lineNoStart := cond (ne .Options.linenostart nil) .Options.linenostart 1 -}} {{- $lineNosDigit := strings.RuneCount (add $lines $lineNoStart) -}} {{- $class := "highlight" -}} {{- with $config.class -}}{{ $class = add $class " " . }}{{- end -}} {{- $targetClass := add "code-block " $class -}} {{- with $config.wrapperclass -}}{{ $targetClass = add $targetClass " " . }}{{- end -}} {{- /* Add code wrapper around the table or pre */ -}} {{- $REin := cond (strings.Contains $wrapper `