Skip to content

Validate code examples in hub prose #17

Description

@Connorrmcd6

Why

A hub's prose often contains example code. Today nothing checks those snippets stay valid — a doc can show a function call that no longer compiles. (Inspired by drift's @example validation, generalized to Surface's freeform hubs.)

What

Validate fenced code blocks in hub prose against the repo: compile / type-check them and report stale examples as a finding. Deterministic — no LLM.

Open questions

  • Per-language strategy (tsc / rustc --edition / py compile / go vet) and how to scope a snippet's imports/context.
  • Opt-in per code block (e.g. a language-tagged fence + a marker) vs all fences.
  • Whether this is a lint finding or a separate surf examples command.

Likely starts with one language (TS or Rust) behind a flag; advisory first.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestresearchOpen question / needs a design spike (proposal §11)

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions