mirror of
https://github.com/imfing/hextra.git
synced 2025-06-20 12:01:29 -04:00
feat: allow enable/disable code block copy button (#331)
* refactor: move codeblock to a partial component * feat: add flags for code block copy button * allow disable code copy button completely * allow make the copy button always visible * chore: run build:css
This commit is contained in:
13
layouts/partials/components/codeblock.html
Normal file
13
layouts/partials/components/codeblock.html
Normal file
@ -0,0 +1,13 @@
|
||||
{{ $filename := .filename | default "" -}}
|
||||
{{ $lang := .lang | default "" }}
|
||||
{{ $content := .content }}
|
||||
{{ $options := .options | default (dict) }}
|
||||
|
||||
{{- if $filename -}}
|
||||
<div class="filename" dir="auto">{{ $filename }}</div>
|
||||
{{- end -}}
|
||||
{{- if transform.CanHighlight $lang -}}
|
||||
<div>{{- highlight $content $lang $options -}}</div>
|
||||
{{- else -}}
|
||||
<pre><code>{{ $content }}</code></pre>
|
||||
{{- end -}}
|
Reference in New Issue
Block a user