---
title: "Cheat sheet"
description: "Every comark-content import, grouped by role."
canonical_url: "https://content.comark.dev/reference/cheat-sheet"
---
# Cheat sheet

> Every comark-content import, grouped by role.

Every entry point `comark-content` ships, grouped by role. Import only what you use: each piece is opt-in.

## Content

```ts
import {
  comarkContent,
  // compose several instances behind one surface (see /advanced/hub)
  contentHub,
  defineContentPlugin,
  // generate the types declaration as a string
  generateSourceTypes,
  // build or decode an artifact (advanced, see /advanced/artifacts-and-hydration)
  buildArtifact, readArtifact,
} from 'comark-content'
```

## Build helpers

Helpers that write to disk during a build step. The CLI and the Vite plugin call them; import them from your own build script. They live in their own entry so the main module stays free of `node:fs`:

```ts
import {
  // write comark-content.d.ts
  writeSourceTypes,
  // write each instance's snapshot + manifest to .content/
  writeSnapshots,
} from 'comark-content/build'
```

## Client

```ts
import { createContentClient, defineContentClientPlugin } from 'comark-content/client'
```

## Sources

```ts
// raw sources — hand over file text for Comark to parse
import fs from 'comark-content/sources/fs'
import github from 'comark-content/sources/github'
import unstorageSource from 'comark-content/sources/unstorage'

// parsed source — hands over content that is already parsed
import snapshot, { withSnapshot } from 'comark-content/sources/snapshot'
```

## Databases

For the SQL query and full-text search plugins:

```ts
import sqlite from 'comark-content/database/sqlite-node'
import sqliteWasm from 'comark-content/database/sqlite-wasm'
```

## Plugins

```ts
// server halves
import sqlQuery from 'comark-content/plugins/sql-query'
import sqliteFullTextSearch from 'comark-content/plugins/sqlite-full-text-search'
import media from 'comark-content/plugins/media'
import json from 'comark-content/plugins/json'
import yaml from 'comark-content/plugins/yaml'
import markdownFields from 'comark-content/plugins/markdown-fields'
import schemaValidation from 'comark-content/plugins/schema-validation'
import references from 'comark-content/plugins/references'
import tracingDebug from 'comark-content/plugins/tracing/debug'
import tracingOtel from 'comark-content/plugins/tracing/otel'

// helpers (import from the plugin entry, not comark-content)
import { markdownField, isMarkdownDocument } from 'comark-content/plugins/markdown-fields'

// client halves
import sqlQueryClient from 'comark-content/plugins/sql-query/client'
import sqliteFullTextSearchClient from 'comark-content/plugins/sqlite-full-text-search/client'
import referencesClient from 'comark-content/plugins/references/client'
```

## Build-time integration

```ts
import comark from 'comark-content/vite'
```

Not using Vite? The CLI covers both build-time jobs:

```bash [Terminal]
npx comark-content prepare   # write comark-content.d.ts
npx comark-content snapshot  # write .content/<name>/{snapshot,manifest}.json
```


## Sitemap

See the full [sitemap](https://content.comark.dev/sitemap.md) for all pages.
