phase 1 5 docs site

Quickstart and API docs are code-heavy. Default Shiki blocks lack filename strips, copy buttons, and line highlights expected in Vercel-quality docs. D.3.3 quickstart mandates `<CodeTabs>` with curl/node/python — copy must work reliably and filenames must render for config snippets.

Milestone D.2.6 — Enhanced code blocks

Status: Complete
Goal: D.2
Phase: 1.5 — Docs Site
Wave: 4
Estimated effort: 3 hours
ADR required: None

Spec detail: MASTER_BRIEF.md Part D (D.2.6).


Why This Milestone Exists

Quickstart and API docs are code-heavy. Default Shiki blocks lack filename strips, copy buttons, and line highlights expected in Vercel-quality docs.

D.3.3 quickstart mandates <CodeTabs> with curl/node/python — copy must work reliably and filenames must render for config snippets.

Shiki themes from D.2.1 must integrate against --panel without injecting conflicting backgrounds.


Non-Goals

  • Runnable code playgrounds (Phase 2+)
  • Syntax highlighting for non-code languages
  • Diff view / line numbers on every block

Branch

feat/d2-6-code-blocks

PR Title

feat(docs): enhanced code blocks (D.2.6)


Prerequisites


Deliverables

  • Copy button: lucide CopyCheck, 1.5s confirm, hover on pre
  • Filename strip: ```text title="src/foo.ts" → 28px bar, mono filename
  • Line highlight: ```ts &#123;3,7-9}bg-panel-raised + 2px accent left border

See MASTER_BRIEF Part D (D.2.6) for full acceptance detail.


Files Affected

File PathActionNotes
docs/app/src/components/mdx/pre.tsxAdd/ModifyEnhanced pre/code wrapper
docs/app/src/components/mdx/copy-button.tsxAddClipboard copy control

Testing Requirements

  • verifyCodeBlock_FilenameStrip: Block with title="…" renders filename bar
  • verifyCodeBlock_CopyButton: Copy puts unhighlighted source on clipboard
  • verifyCodeBlock_LineHighlight: Lines &#123;3,7-9} show highlight in both themes

Acceptance Criteria

  • Filename tab renders for blocks with title="…"
  • Copy button works (clipboard contains unhighlighted source)
  • Highlighted lines visible in dark and light without new colors

Risks

RiskProbabilityImpactMitigation
Clipboard API blocked on HTTP localhostLowMediumDocument HTTPS or localhost exception
Shiki meta parsing breaks MDXMediumHighKeep meta strings per D.2.1 bootstrap note
Copy includes ANSI/highlight spansMediumHighCopy from raw source store, not DOM innerHTML
Edit on GitHub

Last updated on

On this page

0%