Skip to content

Commit 0e31216

Browse files
committed
fix: Update highlight shortcode
1 parent 6311910 commit 0e31216

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

layouts/shortcodes/highlight.html

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{{- $language := .Get 0 -}}
2+
{{- $options := .Get 1 -}}
3+
{{- $codeBlockId := printf "id-%x" (now.UnixNano) -}}
4+
5+
<div class="code-block" data-mf="true" style="display: none;">
6+
{{- if and (ne $language "") (ne $language "none") -}}
7+
<span class="code-type chroma">{{ $language }}</span>
8+
{{- end -}}
9+
<div class="code-container chroma">
10+
<button onclick="copyToClipBoard(this, {{ $codeBlockId }})" class="code-copy-button multi-line" type="button">Copy</button>
11+
<div class="highlight-v2" id="{{ $codeBlockId }}">
12+
{{ if len .Params | eq 2 }}{{ highlight (trim .InnerDeindent "\n\r") (.Get 0) (.Get 1) }}{{ else }}{{ highlight (trim .InnerDeindent "\n\r") (.Get 0) "" }}{{ end }}
13+
</div>
14+
</div>
15+
</div>
16+
17+
<div id="code-block-v1" data-mf="false">
18+
{{ if len .Params | eq 2 }}{{ highlight (trim .InnerDeindent "\n\r") (.Get 0) (.Get 1) }}{{ else }}{{ highlight (trim .InnerDeindent "\n\r") (.Get 0) "" }}{{ end }}
19+
</div>

0 commit comments

Comments
 (0)