Add filename option to codeblocks

This commit is contained in:
Alex Shpak
2025-09-14 23:49:47 +02:00
parent 6c2d102c91
commit 2745893250
3 changed files with 29 additions and 2 deletions
+10
View File
@@ -0,0 +1,10 @@
{{- with (index .Attributes "filename") -}}
{{- $href := index $.Attributes "href" -}}
{{- if $href -}}
{{- $href = partial "docs/links/portable-link" (dict "Page" $.PageInner "Destination" $href) -}}
{{- end -}}
<div class="book-codeblock-filename">
<a {{ with $href }}href="{{ . }}"{{ end }}>{{ . }}</a>
</div>
{{- end -}}
{{- (transform.HighlightCodeBlock . .Options).Wrapped -}}