Add copy to clipboard to code blocks

This commit is contained in:
2023-01-20 17:14:18 -06:00
parent a26ea62b60
commit 47d6d02186
7 changed files with 58 additions and 11 deletions

View File

@ -1,5 +1,13 @@
<div class="code-block">
<div class="code-type">{{ .Type }}</div>
<div class="code-header">
<span class="code-type">{{ .Type }}</span>
<a class="code-copy-button">
{{ i18n "copy_to_clipboard" }}
</a>
</div>
{{/* a div.highlight is already created by highlight function */}}
{{ highlight .Inner .Type }}
{{/* for copy to clipboard */}}
<pre class="code-raw" style="display: none;">{{ .Inner }}</pre>
</div>

View File

@ -13,7 +13,7 @@
<link rel="stylesheet" type="text/css" href="{{ .Permalink }}" integrity="{{ .Data.Integrity }}" crossorigin="anonymous">
{{ end }}
{{ with resources.Get "js/back-to-top.js" | fingerprint "sha512" }}
{{ with resources.Get "js/bobatheme.js" | fingerprint "sha512" }}
<script defer src="{{ .Permalink }}" type="text/javascript" integrity="{{ .Data.Integrity }}" crossorigin="anonymous"></script>
{{ end }}
{{ with resources.Get "js/share-event.js" | fingerprint "sha512" }}