fix: make copy button copy raw markdown
This commit is contained in:
3 files changed
+3
-3
No files matched your search
@@ -231,7 +231,7 @@
|
||||
{{ block "main" . }}{{ end }}
|
||||
<p class="license">Licensed under <a href="https://creativecommons.org/publicdomain/zero/1.0/">CC0 1.0</a> • Copyright © 2025 Stephen Waits</p>
|
||||
<script>
|
||||
function copyCoC(){var t=document.querySelector('.coc-box').innerText;navigator.clipboard.writeText(t).then(function(){alert('Copied!')});}
|
||||
function copyCoC(){var t=document.querySelector('.coc-box').getAttribute('data-raw-content');navigator.clipboard.writeText(t).then(function(){alert('Copied!')});}
|
||||
function updateThemeBtn(){var d=window.matchMedia('(prefers-color-scheme: dark)').matches;var t=document.body.dataset.theme;var dark=t=='dark'||(t==''&&d)||(!t&&d);document.getElementById('theme-btn').textContent=dark?'☀︎':'☾';}
|
||||
function toggleTheme(){var d=window.matchMedia('(prefers-color-scheme: dark)').matches;var t=document.body.dataset.theme;var dark=t=='dark'||(t==''&&d)||(!t&&d);document.body.dataset.theme=dark?'light':'dark';updateThemeBtn();}
|
||||
updateThemeBtn();
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{{ define "title" }}{{ .Title }} | {{ .Site.Title }}{{ end }}
|
||||
|
||||
{{ define "main" }}
|
||||
<div class="coc-box">
|
||||
<div class="coc-box" data-raw-content="{{ .RawContent }}">
|
||||
<button class="copy-btn" onclick="copyCoC()">[copy]</button>
|
||||
{{ .Content }}
|
||||
</div>
|
||||
|
||||
Reference in new issue
Block a user