@@ -16,9 +16,23 @@ const symbols = require('./symbols')
1616
1717const allTypes = Object . keys ( defaultRenderers )
1818
19+ let warningIssuesSource
20+ let warningIssuesEscapeHtml
21+
1922const ReactMarkdown = function ReactMarkdown ( props ) {
20- // To do in next major: remove `source`.
21- const src = props . source || props . children || ''
23+ if ( 'source' in props && ! warningIssuesSource ) {
24+ console . warn ( '[react-markdown] Warning: please use `children` instead of `source`' )
25+ warningIssuesSource = true
26+ }
27+
28+ if ( 'escapeHtml' in props && ! warningIssuesEscapeHtml ) {
29+ console . warn (
30+ '[react-markdown] Warning: please use `allowDangerousHtml` instead of `escapeHtml`'
31+ )
32+ warningIssuesEscapeHtml = true
33+ }
34+
35+ const src = props . children || ''
2236
2337 if ( props . allowedTypes && props . disallowedTypes ) {
2438 throw new Error ( 'Only one of `allowedTypes` and `disallowedTypes` should be defined' )
@@ -61,8 +75,7 @@ function determineAstToReactTransforms(props) {
6175 transforms . push ( disallowNode . ifNotMatch ( props . allowNode , removalMethod ) )
6276 }
6377
64- // To do in next major: remove `escapeHtml`.
65- const renderHtml = ( props . allowDangerousHtml || props . escapeHtml === false ) && ! props . skipHtml
78+ const renderHtml = props . allowDangerousHtml && ! props . skipHtml
6679 const hasHtmlParser = ( props . astPlugins || [ ] ) . some (
6780 ( transform ) => transform . identity === symbols . HtmlParser
6881 )
@@ -87,11 +100,9 @@ ReactMarkdown.defaultProps = {
87100
88101ReactMarkdown . propTypes = {
89102 className : PropTypes . string ,
90- source : PropTypes . string ,
91103 children : PropTypes . string ,
92104 sourcePos : PropTypes . bool ,
93105 rawSourcePos : PropTypes . bool ,
94- escapeHtml : PropTypes . bool ,
95106 allowDangerousHtml : PropTypes . bool ,
96107 skipHtml : PropTypes . bool ,
97108 allowNode : PropTypes . func ,
0 commit comments