mirror of
https://github.com/Kaelio/ktx.git
synced 2026-06-07 07:55:13 +02:00
* docs: streamline quickstart * feat(docs): simplify quickstart code-block styling Remove the fake terminal chrome (traffic lights + zsh header) and language pill from bash blocks, and the teal left-accent from output blocks. Bash fences now render as minimal cards; text fences route to a muted "output" preview. Make detectLanguage recursive and enable addLanguageClass in source.config.ts so Shiki tokens carry through to the renderer. Switch Shiki themes to min-light / github-dark and disable monospace ligatures so flag pairs like --agents keep a visible space. * fix(docs): restore quickstart CI snippets
38 lines
1.1 KiB
TypeScript
38 lines
1.1 KiB
TypeScript
"use client";
|
|
|
|
import { useState } from "react";
|
|
|
|
type Props = {
|
|
mdxSource: string;
|
|
};
|
|
|
|
function stripFrontmatter(source: string) {
|
|
return source.trim().replace(/^---\n[\s\S]*?\n---\n?/, "").trim();
|
|
}
|
|
|
|
export function DocsPageActions({ mdxSource }: Props) {
|
|
const [copied, setCopied] = useState(false);
|
|
|
|
const onCopy = async () => {
|
|
try {
|
|
await navigator.clipboard.writeText(stripFrontmatter(mdxSource));
|
|
setCopied(true);
|
|
setTimeout(() => setCopied(false), 1500);
|
|
} catch {
|
|
// Clipboard denied - fail silently
|
|
}
|
|
};
|
|
|
|
return (
|
|
<div className="not-prose flex flex-wrap items-center gap-2 text-xs">
|
|
<button
|
|
type="button"
|
|
onClick={onCopy}
|
|
className="inline-flex h-8 items-center rounded-md border border-fd-border bg-fd-background px-3 font-medium text-fd-muted-foreground transition-colors hover:border-fd-primary/40 hover:text-fd-foreground data-[state=copied]:border-emerald-500/40 data-[state=copied]:text-emerald-600"
|
|
data-state={copied ? "copied" : "idle"}
|
|
>
|
|
{copied ? "Copied" : "Copy as Markdown"}
|
|
</button>
|
|
</div>
|
|
);
|
|
}
|