@@ -51,59 +51,63 @@ type MarkdownPreviewProps = {
51
51
} & ReactMarkdownProps ;
52
52
```
53
53
54
- This [ ` ReactMarkdownProps ` ] ( https://github.com/remarkjs/react-markdown/blob/22bb78747d768181cb9ea8711b5e13c3768921d8/index.d.ts#L32-L84 ) details.
55
-
56
54
- ` source ` (` string ` , default: ` '' ` )\
57
55
Markdown to parse
58
56
- ` className ` (` string? ` )\
59
57
Wrap the markdown in a ` div ` with this class name
60
- - ` allowDangerousHtml ` (` boolean ` , default: ` false ` )\
61
- This project is safe by default and escapes HTML.
62
- Use ` allowDangerousHtml: true ` to allow dangerous html instead.
63
- See [ security] ( https://github.com/remarkjs/react-markdown/tree/22bb78747d768181cb9ea8711b5e13c3768921d8#security )
58
+
59
+ This [ ` ReactMarkdownProps ` ] ( https://github.com/remarkjs/react-markdown/tree/15b4757082cf3f32a25eba0b8ea30baf751a8b40#props ) details.
60
+
61
+ - ` children ` (` string ` , default: ` '' ` )\
62
+ Markdown to parse
63
+ - ` className ` (` string? ` )\
64
+ Wrap the markdown in a ` div ` with this class name
64
65
- ` skipHtml ` (` boolean ` , default: ` false ` )\
65
- Ignore HTML in Markdown
66
+ Ignore HTML in Markdown completely
66
67
- ` sourcePos ` (` boolean ` , default: ` false ` )\
67
- Pass a prop to all renderers with a serialized position
68
+ Pass a prop to all components with a serialized position
68
69
(` data-sourcepos="3:1-3:13" ` )
69
70
- ` rawSourcePos ` (` boolean ` , default: ` false ` )\
70
- Pass a prop to all renderers with their [ position] ( https://github.com/syntax-tree/unist#position )
71
+ Pass a prop to all components with their [ position] [ ]
71
72
(` sourcePosition: {start: {line: 3, column: 1}, end:…} ` )
72
- - ` includeNodeIndex ` (` boolean ` , default: ` false ` )\
73
- Pass [ ` index ` ] ( https://github.com/syntax-tree/unist#index ) and ` parentChildCount ` in props to all renderers
74
- - ` allowedTypes ` (` Array.<string> ` , default: list of all types)\
75
- Node types to allow (can’t combine w/ ` disallowedTypes ` ).
76
- All types are available at ` ReactMarkdown.types `
77
- - ` disallowedTypes ` (` Array.<string> ` , default: ` [] ` )\
78
- Node types to disallow (can’t combine w/ ` allowedTypes ` )
79
- - ` allowNode ` (` (node, index, parent) => boolean? ` , optional)\
80
- Function called to check if a node is allowed (when truthy) or not.
81
- ` allowedTypes ` / ` disallowedTypes ` is used first!
73
+ - ` includeElementIndex ` (` boolean ` , default: ` false ` )\
74
+ Pass the ` index ` (number of elements before it) and ` siblingCount ` (number
75
+ of elements in parent) as props to all components
76
+ - ` allowedElements ` (` Array.<string> ` , default: ` undefined ` )\
77
+ Tag names to allow (can’t combine w/ ` disallowedElements ` ).
78
+ By default all elements are allowed
79
+ - ` disallowedElements ` (` Array.<string> ` , default: ` undefined ` )\
80
+ Tag names to disallow (can’t combine w/ ` allowedElements ` ).
81
+ By default no elements are disallowed
82
+ - ` allowElement ` (` (element, index, parent) => boolean? ` , optional)\
83
+ Function called to check if an element is allowed (when truthy) or not.
84
+ ` allowedElements ` / ` disallowedElements ` is used first!
82
85
- ` unwrapDisallowed ` (` boolean ` , default: ` false ` )\
83
- Extract (unwrap) the children of not allowed nodes.
84
- By default, when ` strong ` is not allowed, it and it’s content is dropped,
85
- but with ` unwrapDisallowed ` the node itself is dropped but the content used
86
- - ` linkTarget ` (` string ` or ` (url, text, title) => string ` , optional)\
86
+ Extract (unwrap) the children of not allowed elements.
87
+ By default, when ` strong ` is not allowed, it and it’s children is dropped,
88
+ but with ` unwrapDisallowed ` the element itself is dropped but the children
89
+ used
90
+ - ` linkTarget ` (` string ` or ` (href, children, title) => string ` , optional)\
87
91
Target to use on links (such as ` _blank ` for ` <a target="_blank"… ` )
88
- - ` transformLinkUri ` (` (uri ) => string ` , default:
92
+ - ` transformLinkUri ` (` (href, children, title ) => string ` , default:
89
93
[ ` ./uri-transformer.js ` ] [ uri ] , optional)\
90
94
URL to use for links.
91
95
The default allows only ` http ` , ` https ` , ` mailto ` , and ` tel ` , and is
92
96
available at ` ReactMarkdown.uriTransformer ` .
93
97
Pass ` null ` to allow all URLs.
94
- See [ security] ( https://github.com/remarkjs/react-markdown/tree/22bb78747d768181cb9ea8711b5e13c3768921d8#security )
95
- - ` transformImageUri ` (` (uri ) => string ` , default:
98
+ See [ security] [ ]
99
+ - ` transformImageUri ` (` (src, alt, title ) => string ` , default:
96
100
[ ` ./uri-transformer.js ` ] [ uri ] , optional)\
97
101
Same as ` transformLinkUri ` but for images
98
- - ` renderers ` (` Object.<Component> ` , default: ` {} ` )\
99
- Object mapping node types to React components.
100
- Merged with the default renderers (available at ` ReactMarkdown.renderers ` ).
101
- Which props are passed varies based on the node
102
- - ` plugins ` (` Array.<Plugin> ` , default: ` [] ` )\
103
- List of [ remark plugins] ( https://github.com/remarkjs/remark/blob/main/doc/plugins.md#list-of-plugins ) to use.
102
+ - ` components ` (` Object.<string, Component> ` , default: ` {} ` )\
103
+ Object mapping tag names to React components
104
+ - ` remarkPlugins ` (` Array.<Plugin> ` , default: ` [] ` )\
105
+ List of [ remark plugins] [ remark-plugins ] to use.
106
+ See the next section for examples on how to pass options
107
+ - ` rehypePlugins ` (` Array.<Plugin> ` , default: ` [] ` )\
108
+ List of [ rehype plugins] [ rehype-plugins ] to use.
104
109
See the next section for examples on how to pass options
105
110
106
- See [ Options Props] ( https://github.com/remarkjs/react-markdown/tree/22bb78747d768181cb9ea8711b5e13c3768921d8#props ) for more details.
107
111
108
112
## Development
109
113
0 commit comments