Skip to content

Commit

Permalink
theme(feat): better render code block hook
Browse files Browse the repository at this point in the history
  • Loading branch information
davidsneighbour committed Sep 7, 2022
1 parent ad251d3 commit 0497c10
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions layouts/_default/_markup/render-codeblock.html
Original file line number Diff line number Diff line change
Expand Up @@ -55,15 +55,16 @@
</div>
</div>
{{ else }}
<div class="tab-content">{{- range $configTypes -}}
<div class="tab-pane {{ if eq . "toml" }}active{{ end }}" id="{{- $slug -}}-{{- . -}}" role="tabpanel" aria-labelledby="{{- $slug -}}-{{- . -}}-tab" tabindex="0">
{{- $hCode := $.Inner | transform.Remarshal . -}}
{{- if and $fm (in (slice "toml" "yaml") .) -}}
{{- $hCode = printf "%s\n%s\n%s" $placeHolder $hCode $placeHolder -}}
{{- end -}}
{{- $hCode = $hCode | replaceRE `\n+` "\n" }}
{{ highlight $hCode . "" | replaceRE $placeHolder (index $delimiters .) | safeHTML }}
<div class="tab-content">
{{- range $configTypes -}}
<div class="tab-pane {{ if eq . "toml" }}active{{ end }}" id="{{- $slug -}}-{{- . -}}" role="tabpanel" aria-labelledby="{{- $slug -}}-{{- . -}}-tab" tabindex="0">
{{- $hCode := $.Inner | transform.Remarshal . -}}
{{- if and $fm (in (slice "toml" "yaml") .) -}}
{{- $hCode = printf "%s\n%s\n%s" $placeHolder $hCode $placeHolder -}}
{{- end -}}
{{- $hCode = $hCode | replaceRE `\n+` "\n" }}
{{ highlight $hCode . "" | replaceRE $placeHolder (index $delimiters .) | safeHTML }}
</div>
{{- end -}}
</div>
{{- end -}}
</div>
{{ end }}

0 comments on commit 0497c10

Please sign in to comment.