Skip to content

Markdown syntax fails to render inside custom tags #478

Description

@hxj0x

Bug Description

Markdown syntax fails to render inside custom tags when content spans multiple lines

Steps to Reproduce

import { Streamdown } from "streamdown";

// ❌ FAILS: "**bold**" renders as plain text, not bold.
// The content IS inside the component (unlike the header bug), but formatting is lost.
const markdown = "<ai-thinking>\n**bold**</ai-thinking>";

// ✅ WORKS: Single line bold works perfectly.
const markdownSingle = "<ai-thinking>**bold**</ai-thinking>";


function AiThinking(props) {
  return <div style={{ fontSize: 14, backgroundColor: "#3f3f3f3f" }}>{props.children}</div>;
}

export default function Demo() {
  return (
    <Streamdown
        allowedTags={{ "ai-thinking": [] }}
        components={{ "ai-thinking": AiThinking }}
    >
      {markdown}
    </Streamdown>
  );
}

Expected Behavior

When content inside a custom tag contains newlines, the parser should recursively process the inner content as standard Markdown.

Actual Behavior

Markdown syntax fails to render inside custom tags

Code Sample

Streamdown Version

2.5.0

React Version

18

Node.js Version

22

Browser(s)

No response

Operating System

None

Additional Context

No response

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions