Skip to content

Commit

Permalink
Remove deprecated and unneeded defaultProps
Browse files Browse the repository at this point in the history
Closes GH-718.
  • Loading branch information
Lepozepo authored and wooorm committed Dec 15, 2022
1 parent 402fea3 commit 4f98f73
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
9 changes: 7 additions & 2 deletions lib/ast-to-react.js
Expand Up @@ -107,6 +107,7 @@ import {svg, find, hastToReact} from 'property-information'
import {stringify as spaces} from 'space-separated-tokens'
import {stringify as commas} from 'comma-separated-tokens'
import style from 'style-to-object'
import {uriTransformer} from './uri-transformer.js'

const own = {}.hasOwnProperty

Expand Down Expand Up @@ -162,6 +163,10 @@ export function childrenToReact(context, node) {
*/
function toReact(context, node, index, parent) {
const options = context.options
const transform =
options.transformLinkUri === undefined
? uriTransformer
: options.transformLinkUri
const parentSchema = context.schema
/** @type {ReactMarkdownNames} */
// @ts-expect-error assume a known HTML/SVG element.
Expand Down Expand Up @@ -234,8 +239,8 @@ function toReact(context, node, index, parent) {
: options.linkTarget
}

if (name === 'a' && options.transformLinkUri) {
properties.href = options.transformLinkUri(
if (name === 'a' && transform) {
properties.href = transform(
String(properties.href || ''),
node.children,
typeof properties.title === 'string' ? properties.title : null
Expand Down
3 changes: 0 additions & 3 deletions lib/react-markdown.js
Expand Up @@ -32,7 +32,6 @@ import remarkRehype from 'remark-rehype'
import PropTypes from 'prop-types'
import {html} from 'property-information'
import rehypeFilter from './rehype-filter.js'
import {uriTransformer} from './uri-transformer.js'
import {childrenToReact} from './ast-to-react.js'

const own = {}.hasOwnProperty
Expand Down Expand Up @@ -124,8 +123,6 @@ export function ReactMarkdown(options) {
return result
}

ReactMarkdown.defaultProps = {transformLinkUri: uriTransformer}

ReactMarkdown.propTypes = {
// Core options:
children: PropTypes.string,
Expand Down

0 comments on commit 4f98f73

Please sign in to comment.