code-toggle.html (1199B)
1 {{ $langs := (slice "yaml" "toml" "json") }}
2 <div class="code relative" {{ with .Get "file" }}id="{{ . | urlize}}"{{ end }}>
3 <div class="code-nav flex flex-nowrap items-stretch">
4 {{- with .Get "file" -}}
5 <div class="san-serif f6 dib lh-solid pl2 pv2 mr2">{{ . }}.</div>
6 {{- end -}}
7 {{ range $langs }}
8 <button data-toggle-tab="{{ . }}" class="tab-button {{ cond (eq . "yaml") "active" ""}} ba san-serif f6 dib lh-solid ph2 pv2">{{ . }}</button>
9 {{ end }}
10 </div>
11 <div class="tab-content">
12 {{ range $langs }}
13 <div data-pane="{{ . }}" class="code-copy-content nt3 tab-pane {{ cond (eq . "yaml") "active" ""}}">
14 {{ highlight ($.Inner | transform.Remarshal . | safeHTML) . ""}}
15 </div>
16 {{ if ne ($.Get "copy") "false" }}
17 <button class="needs-js copy copy-toggle bg-accent-color-dark f6 absolute top-0 right-0 lh-solid hover-bg-primary-color-dark bn white ph3 pv2" title="Copy this code to your clipboard." data-clipboard-action="copy" aria-label="copy button">
18 </button>
19 {{/* Functionality located within filesaver.js The copy here is located in the css with .copy class so it can be replaced with JS on success */}}
20 {{end}}
21 {{ end }}
22 </div>
23
24 </div>