Interface: DirectiveDescriptor<T>

Implement this interface to create a custom editor for markdown directives. Pass the object in the directivesPlugin parameters.

Type parameters

Type parameterValue
T extends DirectivesDirectives



testNode(node): boolean

Whether the descriptor's Editor should be used for the given node.


nodeDirectivesThe directive mdast node. You can code your logic against the node's name, type, attributes, children, etc.




EditorComponentType<DirectiveEditorProps<T>>The React component to be used as an Editor. See DirectiveEditorProps for the props passed to the component.
attributesstring[]The attributes that the directive has. This can be used when building the UI for the user to configure a directive. The GenericDirectiveEditor uses those to display a property form.
hasChildrenbooleanWhether or not the directive has inner markdown content as children. Used by the GenericDirectiveEditor to determine whether to show the inner markdown editor.
namestringThe name of the descriptor - use this if you're building UI for the user to select a directive.
type?"containerDirective" | "leafDirective" | "textDirective"The type of the supported directive. Can be one of: 'leafDirective' | 'containerDirective' | 'textDirective'.