Configuration for the inline markdown spec
Complete markdown specification object
// Self-closing mention: [mention id="madonna" label="Madonna"]
const mentionSpec = createInlineMarkdownSpec({
nodeName: 'mention',
selfClosing: true,
defaultAttributes: { type: 'user' },
allowedAttributes: ['id', 'label'] // Only these get rendered to markdown
})
// Self-closing emoji: [emoji name="party_popper"]
const emojiSpec = createInlineMarkdownSpec({
nodeName: 'emoji',
selfClosing: true,
allowedAttributes: ['name']
})
// With content: [highlight color="yellow"]text[/highlight]
const highlightSpec = createInlineMarkdownSpec({
nodeName: 'highlight',
selfClosing: false,
allowedAttributes: ['color', 'style']
})
// Usage in extension:
export const Mention = Node.create({
name: 'mention', // Must match nodeName
// ... other config
markdown: mentionSpec
})
Creates a complete markdown spec for inline nodes using attribute syntax.
The generated spec handles:
[nodeName attributes]content[/nodeName]format[emoji name=party_popper]