react-antdown

1.0.11 • Public • Published

version build test coverage

react-antdown

Simply put, this component wraps the output of react-markdown with a className of .ant-typography, ensuring that the HTML output of react-markdown will pick up CSS rules as defined by Ant Design.

Install

Install react-antdown npm module as a dependency of your antd project with npm.

npm install react-antdown --save

or, with yarn...

yarn add react-antdown

Basic Usage

import React from 'react'
import ReactAntdown from 'react-antdown'

const someMarkdown = `# This is the title

This is some text

* List item 1
* List item 2
  * List item 2.1
  * List item 2.2

This is a [link](https://www.google.com/?q=markdown)`

const MyComponent = () => {
  return (
    <ReactAntdown>
      {someMarkdown}
    </ReactAntdown>
  )
}

export default MyComponent

API

props

  • children (string, default: '')
    The Markdown to pass to ReactMarkdown
  • className (string?)
    Any additional className(s), to be appended to the defaults: 'react-antdown', 'ant-typography'

Any other props specified will be passed along to the internal instance of react-markdown.

The full list of props that react-markdown supports can be viewed in the react-markdown documentation on GitHub.

Package Sidebar

Install

npm i react-antdown

Weekly Downloads

10

Version

1.0.11

License

MIT

Unpacked Size

123 kB

Total Files

5

Last publish

Collaborators

  • dwayneanderson