How it works
How content gets from a source to your app.
Comark Content is a small layer between your content and your app. It reads files from a source, parses each one with Comark, indexes them and serves them through a typed API.
Start with the essentials
content.ts
import { comarkContent } from 'comark-content'
import fs from 'comark-content/sources/fs'
export const content = comarkContent({
source: fs('./content'),
})- Source loads raw keys and their contents (
keys(),getItem()). - Manifest is an in-memory index of every entry by path, so lookups and listings hit RAM, never the source.
- Parse happens on
get()and turns each Markdown file into an object. - Cache keeps each parsed body so the next
get()skips the parse. It's in-memory by default, so this works with zero setup. - Client exposes the result through
get(),list(),navigation(), andhandler().
Add layers as you grow
These optional layers speed up reads and add capabilities: