diff --git a/lib/react-markdown.js b/lib/react-markdown.js index da32d1e5..48ba44e3 100644 --- a/lib/react-markdown.js +++ b/lib/react-markdown.js @@ -65,6 +65,8 @@ const deprecated = { } /** + * React component to render markdown. + * * @param {ReactMarkdownOptions} options * @returns {ReactElement} */ diff --git a/package.json b/package.json index 6615f519..b868cc83 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "react-markdown", "version": "7.1.0", - "description": "Render Markdown as React components", + "description": "React component to render markdown", "license": "MIT", "keywords": [ "remark", diff --git a/readme.md b/readme.md index ffccd5c4..926e9369 100644 --- a/readme.md +++ b/readme.md @@ -1,3 +1,9 @@ + + # react-markdown [![Build][build-badge]][build] @@ -8,30 +14,98 @@ [![Backers][backers-badge]][collective] [![Chat][chat-badge]][chat] -Markdown component for React using [**remark**][remark]. +React component to render markdown. + +## Feature highlights + +* [x] **[safe][security] by default** + (no `dangerouslySetInnerHTML` or XSS attacks) +* [x] **[components][]** + (pass your own component to use instead of `
react-markdown
+ +----------------------------------------------------------------------------------------------------------------+
+ | |
+ | +----------+ +----------------+ +---------------+ +----------------+ +------------+ |
+ | | | | | | | | | | | |
+markdown-+->+ remark +-mdast->+ remark plugins +-mdast->+ remark-rehype +-hast->+ rehype plugins +-hast->+ components +-+->react elements
+ | | | | | | | | | | | |
+ | +----------+ +----------------+ +---------------+ +----------------+ +------------+ |
+ | |
+ +----------------------------------------------------------------------------------------------------------------+
+
+
+To understand what this project does, it’s important to first understand what
+unified does: please read through the [`unifiedjs/unified`][unified] readme (the
+part until you hit the API section is required reading).
+
+`react-markdown` is a unified pipeline — wrapped so that most folks don’t need
+to directly interact with unified.
+The processor goes through these steps:
+
+* parse markdown to mdast (markdown syntax tree)
+* transform through remark (markdown ecosystem)
+* transform mdast to hast (HTML syntax tree)
+* transform through rehype (HTML ecosystem)
+* render hast to React with components
## Appendix A: HTML in markdown
@@ -432,7 +547,7 @@ markdown!
You can also change the things that come from markdown:
-```js
+```jsx