feat: syntax highlighting with shiki and copy-to-clipboard for all docs code blocks

This commit is contained in:
Vectry
2026-02-10 04:01:59 +00:00
parent 42b5379ce1
commit 5b388484f8
14 changed files with 642 additions and 200 deletions

View File

@@ -1,4 +1,5 @@
import type { Metadata } from "next";
import { CodeBlock } from "@/components/code-block";
export const metadata: Metadata = {
title: "REST API Reference",
@@ -6,21 +7,6 @@ export const metadata: Metadata = {
"Complete API contract for AgentLens trace ingestion and retrieval endpoints.",
};
function CodeBlock({ children, title }: { children: string; title?: string }) {
return (
<div className="rounded-xl overflow-hidden border border-neutral-800 bg-neutral-900/50 my-4">
{title && (
<div className="px-4 py-2.5 border-b border-neutral-800 text-xs text-neutral-500 font-mono">
{title}
</div>
)}
<pre className="p-4 overflow-x-auto text-sm leading-relaxed">
<code className="text-neutral-300">{children}</code>
</pre>
</div>
);
}
function EndpointHeader({
method,
path,
@@ -86,7 +72,7 @@ export default function ApiReferencePage() {
<h3 className="text-lg font-medium text-neutral-200 mb-3">
Request body
</h3>
<CodeBlock title="request_body.json">{`{
<CodeBlock title="request_body.json" language="json">{`{
"traces": [
{
"id": "trace-uuid-v4",
@@ -497,7 +483,7 @@ export default function ApiReferencePage() {
<h3 className="text-lg font-medium text-neutral-200 mb-3 mt-8">
cURL example
</h3>
<CodeBlock title="terminal">{`curl -X POST https://agentlens.vectry.tech/api/traces \\
<CodeBlock title="terminal" language="bash">{`curl -X POST https://agentlens.vectry.tech/api/traces \\
-H "Content-Type: application/json" \\
-H "Authorization: Bearer your-api-key" \\
-d '{
@@ -599,7 +585,7 @@ export default function ApiReferencePage() {
<h3 className="text-lg font-medium text-neutral-200 mb-3 mt-8">
Response shape
</h3>
<CodeBlock title="response.json">{`{
<CodeBlock title="response.json" language="json">{`{
"traces": [
{
"id": "...",