Skip to content

agonist/contentbit

Repository files navigation

contentbit

npm npm CI MIT

contentbit

Structured Markdown components without framework lock-in. npx contentbit@latest init, then ask your coding agent to write a post — it fetches the live authoring guide, writes, and validates until clean.

LLMs are fluent in Markdown, and that fluency is the problem: generated content looks right and breaks in production. Content Blocks is a content protocol that fixes the interface. Authors (humans, CMSes, LLMs) write plain Markdown with directive blocks:

:::comparison{left="Basic" right="Pro"}
- Price | Free | $12/mo
- Support | Community | Priority
:::

Every block has a schema. Validation runs before anything renders and produces file:line:col diagnostics a human or a model can act on. The same registry that validates content also generates the LLM authoring instructions, so schema, docs, and prompts can never drift apart.

article.md:12:1 error CB_PROPS_INVALID
:::callout props invalid: type must be one of note|tip|warning|important|tldr.
hint: Did you mean type="warning"?

Quick start

npx contentbit@latest init

One command: detects your framework and package manager, installs the packages, scaffolds a starter document, a custom block, and a rendered /example page, generates LLM authoring instructions, and wires in your coding agent. In shadcn projects it also installs the styled component pack.

Prefer the pieces? pnpm add @contentbit/core @contentbit/blocks plus the renderer of your choice. Full walkthrough: contentbit.dev/docs.

Ask your agent

After init, your agent knows how to write content for this project:

"write a blog post about X"  ·  "audit my content"

contentbit agents (included in init) installs Claude Code skills and an AGENTS.md block, so writing fetches the live guide and validates until clean, and auditing ranks findings from contentbit stats JSON. The skills hold no schemas; they read everything from the CLI at runtime, so custom blocks are picked up automatically. See contentbit.dev/docs/guides/agents.

The loop

What runs under the hood — yourself or via the skills:

  1. Generate the authoring guide from your registry: contentbit instructions --audience llm
  2. Let the model write plain Markdown with blocks. Nothing executable.
  3. Validate: contentbit validate "content/**/*.md" exits 1 with precise diagnostics.
  4. Feed diagnostics back to the model until clean. Render anywhere: React, Astro, static HTML, or plain Markdown.

Packages

Package Purpose
@contentbit/core Parser, AST, diagnostics, registry, validation, content models, authoring guide, Markdown fallback
@contentbit/blocks Generic block definitions (callout, steps, comparison, tabs, faq, ...)
@contentbit/html Static HTML renderer, works without JavaScript
@contentbit/react React renderer with headless accessible defaults
@contentbit/astro Astro renderer: .astro components with per-block overrides
contentbit CLI: init / validate / stats / render / instructions / docs / agents

The styled component pack ships through a shadcn registry: pnpm dlx shadcn@latest add @contentbit/generic-pack (registry: https://contentbit.dev/r/{name}.json).

Explore

Development

pnpm install
pnpm -r build
pnpm -r test
pnpm lint && pnpm fmt:check

See CONTRIBUTING.md for the repo layout and guidelines.

License

MIT

About

Structured Markdown components without framework lock-in. Validated blocks for content written by humans, CMSes, and LLMs.

Topics

Resources

License

Contributing

Stars

Watchers

Forks

Packages

 
 
 

Contributors