Files
kind/site/layouts/shortcodes/codeFromInline.html
Asbjørn Apeland 15455817ef doc: refactor copy to clipboard button (#2894)
* doc: remove copy button background colour

the motivation for this commit is that I often get a feeling of having
marked the COPY buttons, but when I check, it turns out I haven't

that happens because the COPY buttons have a background colour that is
basically the same as when you mark text

* doc: use emoji for copy button

kind seems to be fond of emojis, it can maybe work here as well?

* doc: copy kubernetes.io code blocks design

as per feedback in PR

* doc: comply with copycode.svg license

* Revert "doc: comply with copycode.svg license"

This reverts commit c018fda4bc.
2022-10-26 07:45:57 -07:00

22 lines
613 B
HTML

{{ $code := trim .Inner "\n" }}
{{ $lang := "" }}
{{ with .Get "lang" }}{{ $lang = . }}{{ end }}
{{ $hash := md5 $code }}
<table class="includecode" id="inline-code-{{ $hash }}">
<thead>
<tr>
<th>
<button onclick='copyText("inline-code-{{ $hash }}-hidden-copy-text");' title="Copy to clipboard">
<img src="{{ "copycode.svg" | relURL }}" alt="Copy">
</button>
</th>
</tr>
</thead>
<tbody>
<tr>
<td>{{ highlight $code $lang "" }}</td>
</tr>
</tbody>
<textarea class="hidden-copy-text" id="inline-code-{{ $hash }}-hidden-copy-text">{{ $code }}</textarea>
</table>