Skip to content

Commit 77fc703

Browse files
committed
fix: Codeblock rendering with extra options
1 parent 78599a2 commit 77fc703

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

layouts/_default/_markup/render-codeblock.html

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
{{ $codeBlockId := printf "id-%x" (now.UnixNano) }}
33
{{ $lines := split $result.Wrapped "\n" }}
44
{{ $isSingleLine := eq (len $lines) 1 }}
5+
{{- $opts := dict "noClasses" false -}}
6+
{{- $lang := .Type -}}
7+
{{- $highlightingResult := transform.HighlightCodeBlock . $opts -}}
58

69
{{- if $isSingleLine -}}
710
<div class="code-block" data-mf="true" style="display: none;">
@@ -20,10 +23,11 @@
2023
<div class="code-container chroma">
2124
<button onclick="copyToClipBoard(this, {{ $codeBlockId }})" class="code-copy-button multi-line" type="button">Copy</button>
2225
<div class="highlight-v2" id="{{ $codeBlockId }}">
23-
{{ $result.Wrapped }}
26+
<div class="highlight"><pre class="chroma" tabindex="0"><code class="language-{{ $lang }}" data-lang="{{ $lang }}">{{- $highlightingResult.Inner -}}</code></pre></div>
2427
</div>
2528
</div>
2629
</div>
30+
2731
{{- end -}}
2832
<div id="code-block-v1" data-mf="false">
2933
{{ $result.Wrapped }}

0 commit comments

Comments
 (0)