Skip to content
This page is available as Markdown at /api/editor/functions/defineannotation.md. For the full documentation index, see /llms.txt, or the complete corpus at /llms-full.txt.

defineAnnotation

defineAnnotation(config): Annotation

Defined in: packages/editor/src/renderers/renderer.types.ts:556

Define an annotation renderer for a _type declared in the schema’s annotations array, or '*' to match every annotation type. The returned registration is mounted via the <NodePlugin> component.

Annotation _types live in a different namespace than node _types, so type has no forbidden values here (unlike defineInlineObject/defineBlockObject).

AnnotationRender

string

Annotation

defineAnnotation({
type: 'link',
render: ({annotation, children}) => (
<a href={(annotation as {href?: string}).href}>{children}</a>
),
})