Fix screenshot assets and code blocks

This commit is contained in:
Codex
2026-07-08 05:46:12 +00:00
parent 743c1332fd
commit 02419f7161
3 changed files with 51 additions and 4 deletions
+16 -1
View File
@@ -80,9 +80,14 @@ h1 { margin: 0; font-size: clamp(28px, 5vw, 44px); line-height: 1.12; letter-spa
.content li > p { margin: 0.2em 0; }
.content li > ul, .content li > ol { margin: 0.35em 0 0.45em; padding-left: 1.25em; }
.content strong { font-weight: 700; }
.content pre { margin: 1em 0; overflow: auto; padding: 14px 16px; border-radius: 8px; background: var(--code-bg); color: var(--code); font-size: 14px; line-height: 1.55; }
.content pre { margin: 1em 0; overflow: auto; padding: 14px 16px; border-radius: 8px; background: var(--code-bg); color: var(--code); font-size: 14px; line-height: 1.55; white-space: pre; overflow-wrap: normal; word-break: normal; }
.content code { font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Noto Sans Mono", monospace; }
.content :not(pre) > code { background: var(--code-bg); border-radius: 5px; padding: 0.1em 0.32em; }
.code-block { margin: 1em 0; border-radius: 8px; background: var(--code-bg); overflow: hidden; }
.code-block .code-header { min-height: 34px; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 6px 10px 6px 14px; color: var(--muted); font-size: 12px; border-bottom: 1px solid var(--border); }
.code-block .code-header span:empty::before { content: "code"; }
.code-block [data-copy-code] { border: 0; background: transparent; color: var(--muted); font: inherit; font-size: 12px; padding: 4px 6px; cursor: pointer; }
.code-block pre { margin: 0; border-radius: 0; background: transparent; }
.content table { width: 100%; border-collapse: collapse; margin: 1em 0; display: block; overflow-x: auto; }
.content th, .content td { border: 1px solid var(--border); padding: 8px 10px; text-align: left; vertical-align: top; }
.content blockquote { border-left: 3px solid var(--border); margin: 1em 0; padding-left: 14px; color: var(--muted); }
@@ -125,6 +130,16 @@ function pageScript(slug: string): string {
copy.textContent = "Copied";
setTimeout(function () { copy.textContent = "Copy link"; }, 1400);
});
document.querySelectorAll("[data-copy-code]").forEach(function (button) {
button.addEventListener("click", async function () {
var block = button.closest(".code-block");
var code = block && block.querySelector("code");
if (!code) return;
await navigator.clipboard.writeText(code.textContent || "");
button.textContent = "Copied";
setTimeout(function () { button.textContent = "Copy"; }, 1400);
});
});
var form = document.querySelector("[data-shot-form]");
if (form) form.addEventListener("submit", function (event) {
event.preventDefault();