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

    Function renderNestedMarkdownContent

    • Utility function for rendering content with a main line prefix and nested indented content.

      This function handles the common pattern of rendering content with:

      1. A main line with a prefix (like "- " for lists, "> " for blockquotes, etc.)
      2. Nested content that gets indented properly

      Parameters

      • node: JSONContent

        The ProseMirror node representing the content

      • h: {
            indent: (text: string) => string;
            renderChildren: (nodes: JSONContent[]) => string;
        }

        The markdown renderer helper

      • prefixOrGenerator: string | ((ctx: any) => string)

        Either a string prefix or a function that generates the prefix from context

      • Optionalctx: any

        Optional context object (used when prefixOrGenerator is a function)

      Returns string

      The rendered markdown string

      // For a bullet list item with static prefix
      return renderNestedMarkdownContent(node, h, '- ')

      // For a task item with static prefix
      const prefix = `- [${node.attrs?.checked ? 'x' : ' '}] `
      return renderNestedMarkdownContent(node, h, prefix)

      // For a blockquote with static prefix
      return renderNestedMarkdownContent(node, h, '> ')

      // For content with dynamic prefix based on context
      return renderNestedMarkdownContent(node, h, ctx => {
      if (ctx.parentType === 'orderedList') {
      return `${ctx.index + 1}. `
      }
      return '- '
      }, ctx)

      // Custom extension example
      const CustomContainer = Node.create({
      name: 'customContainer',
      // ... other config
      markdown: {
      render: (node, h) => {
      const type = node.attrs?.type || 'info'
      return renderNestedMarkdownContent(node, h, `[${type}] `)
      }
      }
      })