react-showdown is a React component library designed for rendering Markdown content within React applications. It leverages the underlying Showdown.js parser, providing a robust solution for Markdown-to-HTML conversion. A key differentiator of this library is its unique capability to embed actual React components directly within Markdown text, which are then rendered seamlessly as part of the React component tree. This feature significantly enhances interactivity and modularity, moving beyond static HTML. The library, currently at stable version 2.3.1, also boasts full TypeScript support and offers extensive configuration options by supporting all Showdown extensions and flavors. While a specific release cadence isn't explicitly stated, the version history (2.0, 2.1, 2.3.1) suggests a pattern of incremental updates focused on new features and bug fixes.
npm install react-showdownVerified import paths — ran on the pinned version, not inferred.
Demonstrates rendering basic Markdown with options and embedding a custom React component within Markdown text.
Review markdown content and converter options, especially if self-closing HTML-like tags (e.g., `<br/>`) are used. If previous behavior is desired, explicitly set `options={{ recognizeSelfClosing: false }}`.Upgrade your project's React dependency to version 16 or higher. Use `npm install react@^16.0.0 react-dom@^16.0.0` or `yarn add react@^16.0.0 react-dom@^16.0.0`.
Ensure the `components` prop is an object with direct references to your React components: `<MarkdownView components={{ YourComponent }} />`.Always pass a string value, even an empty one, to the `markdown` prop: `<MarkdownView markdown={myMarkdownString} />`.Upgrade `react-showdown` to version 2.1.0 or newer. If upgrading isn't an option, or if the issue persists, ensure `options={{ recognizeSelfClosing: true }}` is passed to `MarkdownView`.