Bindings

Data and meta

Tell the editor about the data your renderer passes.

Pass a sample value or a JSON Schema. Samples are handy in apps (use the real data); schemas also let lint flag unknown keys.

comark({
  data: { user: { name: 'Ada' }, posts: [{ title: 'Hello', slug: 'hello' }] },
  // or
  dataSchema: {
    type: 'object',
    properties: {
      user: { type: 'object', properties: { name: { type: 'string', description: 'Display name' } } },
      posts: { type: 'array', items: { type: 'object', properties: { title: { type: 'string' } } } },
    },
  },
  metaSchema: { type: 'object', properties: { lang: { enum: ['en', 'de'] } } },
})

Arrays offer indices (posts.0) and length. Schema descriptions and enums show in the docs panel.

Frontmatter schema

frontmatterSchema drives completion inside the frontmatter: keys (nested objects drill in), enum and boolean values, and lint for required keys and enum values.

comark({
  frontmatterSchema: {
    type: 'object',
    required: ['title'],
    properties: {
      title: { type: 'string' },
      layout: { enum: ['docs', 'page', 'blog'] },
      seo: { type: 'object', properties: { image: { type: 'string' } } },
    },
  },
})

Binding completion of frontmatter.* does not need a schema: it reads the document's own frontmatter.

Copyright © 2026