# comark-content

> Content layer for Comark

Latest version **0.4.1** (published 2026-09-14) · MIT license · 0 weekly downloads

## Install

```sh
npm install comark-content
pnpm add comark-content
yarn add comark-content
bun add comark-content
```

Provides the command `comark-content`.

## Health

**Score 70/100 (B)** — status: active.

Positive: has types; esm support; no vulnerabilities; recently updated; high maintenance score; high quality score.

Warnings: low downloads; pre 1.0.

## Facts

| | |
|---|---|
| Version | 0.4.1 |
| Published | 2026-09-14 |
| First published | 2026-08-04 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 10 |
| Unpacked size | 424.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | atinux, farnabaz |

## Links

- npm: https://www.npmjs.com/package/comark-content
- Repository: https://github.com/comarkdown/comark-content
- Homepage: https://content.comark.dev
- Issues: https://github.com/comarkdown/comark-content/issues
- npm.io page: https://npm.io/package/comark-content

## Dependencies (10)

- [ufo](https://npm.io/package/ufo.md) ^1.6.4
- [jiti](https://npm.io/package/jiti.md) ^2.7.0
- [citty](https://npm.io/package/citty.md) ^0.2.2
- [pathe](https://npm.io/package/pathe.md) ^2.0.3
- [comark](https://npm.io/package/comark.md) ^0.7.0
- [ofetch](https://npm.io/package/ofetch.md) ^1.5.1
- [slugify](https://npm.io/package/slugify.md) ^1.6.9
- [hookable](https://npm.io/package/hookable.md) ^6.1.1
- [picomatch](https://npm.io/package/picomatch.md) ^4.0.7
- [unstorage](https://npm.io/package/unstorage.md) ^1.17.5

## Recent versions

- 0.4.1 (latest) — 2026-09-14
- 0.4.0 — 2026-09-11
- 0.3.0 — 2026-08-04
- 0.2.0 — 2026-08-04

## README

<img src="https://github.com/comarkdown/comark-content/blob/main/assets/banner-content.jpg" width="100%" alt="Comark Content banner" />

# comark-content

[![npm version](https://img.shields.io/npm/v/comark-content?color=black)](https://npmx.dev/comark-content)
[![npm downloads](https://img.shields.io/npm/dm/comark-content?color=black)](https://npm.chart.dev/comark-content)
[![CI](https://img.shields.io/github/actions/workflow/status/comarkdown/comark-content/ci.yml?branch=main&color=black)](https://github.com/comarkdown/comark-content/actions/workflows/ci.yml)
[![Documentation](https://img.shields.io/badge/Documentation-black?logo=readme&logoColor=white)](https://content.comark.dev)
[![license](https://img.shields.io/github/license/comarkdown/comark-content?color=black)](./LICENSE)

Universal content layer for Markdown-driven websites. Comark Content turns Markdown from the filesystem, GitHub, or any storage driver into a queryable, searchable, type-safe API. Framework-agnostic, it runs on a server, at the edge, or fully in the browser. Built on [Comark](https://comark.dev).

## Why Comark Content

- **Runtime-first**: read content from its source on demand, or hydrate from a build-time snapshot when the source won't be available in production.
- **Lightweight core**: three methods — `get`, `list`, `navigation`. Everything else is an opt-in plugin.
- **Pluggable sources**: filesystem, GitHub, or any [unstorage](https://unstorage.unjs.io) driver (S3, KV, Redis, HTTP).
- **Type-safe**: generated types narrow `get()`, `list()`, and `query()` by instance and by path.
- **SQL queries & full-text search**: opt into a SQLite-backed query builder and BM25 search over frontmatter and content.
- **Runs anywhere**: Node, edge, or fully in the browser with a hydrated snapshot.
- **Framework-agnostic**: returns a plain Comark AST, rendered by Vue, React, Svelte, Angular, or plain HTML.

## Quick start

```sh
pnpm add comark-content
```

Write a Markdown file:

```md
<!-- content/about.md -->
---
title: About
---

# About us

We write documentation for a living.
```

Read it:

```ts
import { comarkContent } from 'comark-content'
import fs from 'comark-content/sources/fs'

export const content = comarkContent({
  source: fs('./content'),
})

const page = await content.get('/about') // reads ./content/about.md
page?.data.title // 'About'
page?.nodes // parsed body, ready for a Comark renderer

const pages = await content.list() // frontmatter of every page
const nav = await content.navigation() // tree built from your folders
```

Then render `page` with a Comark renderer for your framework (`@comark/vue`, `@comark/react`, `@comark/svelte`, `@comark/html`). The [framework guides](https://content.comark.dev/getting-started/render-your-first-page) cover Nuxt, Next.js, SvelteKit, Vite, Nitro, Node, and Hono.

Swap the source for GitHub, or any [unstorage](https://unstorage.unjs.io) driver — same API:

```ts
import github from 'comark-content/sources/github'

const content = comarkContent({
  source: github({ repo: 'nuxt/nuxt', branch: 'main', path: 'docs' }),
})
```

## Add more when you need it

Everything below is optional. Reach for it when your app has the need.

- **Types from your frontmatter.** `npx comark-content prepare` writes `comark-content.d.ts`, so `get('/about')` autocompletes and `data.title` is typed. The Vite plugin does this for you. [Add TypeScript types](https://content.comark.dev/guide/typescript)
- **Search and queries.** Add SQLite (Node or WASM) through a plugin for BM25 full-text search and a fluent query builder over frontmatter. [Plugins](https://content.comark.dev/plugins)
- **Several sources.** Create one instance per source and compose them with `contentHub()` behind one navigation tree and one handler. [Combine content sources](https://content.comark.dev/advanced/hub)
- **Deploy without the files.** `npx comark-content snapshot` writes the parsed content so a serverless function or a browser app can serve it with no filesystem. [Deploy with a content snapshot](https://content.comark.dev/deployment/with-a-snapshot)
- **Remote content that stays current.** Read from GitHub, pin a commit, and refresh from a webhook. [Keep remote content up to date](https://content.comark.dev/deployment/remote-content)

## CLI

The `comark-content` binary provides two commands: `prepare` generates types, and `snapshot` writes each instance's parsed content.

```sh
npx comark-content prepare              # find content.{ts,mts,js,mjs}, write ./comark-content.d.ts
npx comark-content prepare --config server/content.ts -o types/comark-content.d.ts
npx comark-content snapshot             # write .content/<name>/{snapshot,manifest}.json
npx comark-content --help
```

See the [CLI reference](https://content.comark.dev/reference/cli) for all flags.

## Documentation

Full guides, concepts, and API reference at [content.comark.dev](https://content.comark.dev).

## License

Made with ❤️

Published under [MIT License](./LICENSE).

---
_Source: https://npm.io/package/comark-content · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
