Skip to content

Commit 4f98f73

Browse files
Lepozepowooorm
authored andcommittedDec 15, 2022
Remove deprecated and unneeded defaultProps
Closes GH-718.
1 parent 402fea3 commit 4f98f73

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed
 

‎lib/ast-to-react.js

+7-2
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ import {svg, find, hastToReact} from 'property-information'
107107
import {stringify as spaces} from 'space-separated-tokens'
108108
import {stringify as commas} from 'comma-separated-tokens'
109109
import style from 'style-to-object'
110+
import {uriTransformer} from './uri-transformer.js'
110111

111112
const own = {}.hasOwnProperty
112113

@@ -162,6 +163,10 @@ export function childrenToReact(context, node) {
162163
*/
163164
function toReact(context, node, index, parent) {
164165
const options = context.options
166+
const transform =
167+
options.transformLinkUri === undefined
168+
? uriTransformer
169+
: options.transformLinkUri
165170
const parentSchema = context.schema
166171
/** @type {ReactMarkdownNames} */
167172
// @ts-expect-error assume a known HTML/SVG element.
@@ -234,8 +239,8 @@ function toReact(context, node, index, parent) {
234239
: options.linkTarget
235240
}
236241

237-
if (name === 'a' && options.transformLinkUri) {
238-
properties.href = options.transformLinkUri(
242+
if (name === 'a' && transform) {
243+
properties.href = transform(
239244
String(properties.href || ''),
240245
node.children,
241246
typeof properties.title === 'string' ? properties.title : null

‎lib/react-markdown.js

-3
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ import remarkRehype from 'remark-rehype'
3232
import PropTypes from 'prop-types'
3333
import {html} from 'property-information'
3434
import rehypeFilter from './rehype-filter.js'
35-
import {uriTransformer} from './uri-transformer.js'
3635
import {childrenToReact} from './ast-to-react.js'
3736

3837
const own = {}.hasOwnProperty
@@ -124,8 +123,6 @@ export function ReactMarkdown(options) {
124123
return result
125124
}
126125

127-
ReactMarkdown.defaultProps = {transformLinkUri: uriTransformer}
128-
129126
ReactMarkdown.propTypes = {
130127
// Core options:
131128
children: PropTypes.string,

0 commit comments

Comments
 (0)
Please sign in to comment.