Socket
Socket
Sign inDemoInstall

@uiw/react-markdown-preview

Package Overview
Dependencies
Maintainers
2
Versions
109
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@uiw/react-markdown-preview

React component preview markdown text in web browser. The minimal amount of CSS to replicate the GitHub Markdown style.


Version published
Weekly downloads
119K
increased by3.88%
Maintainers
2
Weekly downloads
ย 
Created

What is @uiw/react-markdown-preview?

@uiw/react-markdown-preview is a React component for rendering Markdown text. It provides a simple way to preview Markdown content in a React application, supporting various Markdown features and extensions.

What are @uiw/react-markdown-preview's main functionalities?

Basic Markdown Rendering

This feature allows you to render basic Markdown content. The `source` prop takes a string of Markdown text and renders it as HTML.

import React from 'react';
import MarkdownPreview from '@uiw/react-markdown-preview';

const App = () => (
  <MarkdownPreview source={'# Hello World\nThis is a **Markdown** preview!'} />
);

export default App;

Customizing Styles

You can customize the styles of the rendered Markdown by applying custom CSS classes. The `className` prop allows you to add custom styles to the Markdown content.

import React from 'react';
import MarkdownPreview from '@uiw/react-markdown-preview';
import './custom.css';

const App = () => (
  <MarkdownPreview source={'# Hello World\nThis is a **Markdown** preview!'} className='custom-markdown' />
);

export default App;

Using Plugins

This feature allows you to use plugins to extend the functionality of the Markdown renderer. For example, you can use the `rehype-sanitize` plugin to sanitize the HTML output.

import React from 'react';
import MarkdownPreview from '@uiw/react-markdown-preview';
import rehypeSanitize from 'rehype-sanitize';

const App = () => (
  <MarkdownPreview source={'# Hello World\nThis is a **Markdown** preview!'} rehypePlugins={[[rehypeSanitize]]} />
);

export default App;

Other packages similar to @uiw/react-markdown-preview

Keywords

FAQs

Package last updated on 12 Sep 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with โšก๏ธ by Socket Inc