@umbraco-cms/backoffice
    Preparing search index...

    Function createInlineMarkdownSpec

    • Creates a complete markdown spec for inline nodes using attribute syntax.

      The generated spec handles:

      • Parsing shortcode syntax with [nodeName attributes]content[/nodeName] format
      • Self-closing shortcodes like [emoji name=party_popper]
      • Extracting and parsing attributes from the opening tag
      • Rendering inline elements back to shortcode markdown
      • Supporting both content-based and self-closing inline elements

      Parameters

      Returns {
          markdownTokenizer: MarkdownTokenizer;
          parseMarkdown: (
              token: MarkdownToken,
              h: MarkdownParseHelpers,
          ) => MarkdownParseResult;
          renderMarkdown: (node: JSONContent) => string;
      }

      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
      })