Détail du package

@portabletext/schema

portabletext0MIT1.2.0

Portable Text Schema

portabletext, schema

readme

@portabletext/schema

A TypeScript library for defining and compiling Portable Text schemas with full type safety and editor support.

Installation

npm install @portabletext/schema

Usage

Define a Schema

import {defineSchema} from '@portabletext/schema'

const schemaDefinition = defineSchema({
  styles: [{name: 'normal'}, {name: 'h1'}, {name: 'h2'}, {name: 'blockquote'}],
  decorators: [{name: 'strong'}, {name: 'em'}],
  annotations: [{name: 'link'}],
  lists: [{name: 'bullet'}, {name: 'numbered'}],
})

Compile Schema

import {compileSchema} from '@portabletext/schema'

const schema = compileSchema(schemaDefinition)