Member Junction
    Preparing search index...
    • Split Markdown text into typed sections for platform-specific formatting.

      Handles:

      • Fenced code blocks (...)
      • ATX headers (# , ## , ### )
      • Paragraph breaks (blank lines)
      • Inline text paragraphs

      Parameters

      • markdown: string

        Raw Markdown text from an agent response.

      Returns MarkdownSection[]

      Array of sections with type and content.

      const sections = splitMarkdownIntoSections('# Title\n\nSome text\n\n```js\nconsole.log("hi")\n```');
      // [
      // { Type: 'header', Content: 'Title' },
      // { Type: 'text', Content: 'Some text' },
      // { Type: 'code', Content: 'console.log("hi")' }
      // ]