Skip to content
This repository was archived by the owner on May 29, 2025. It is now read-only.

Conversation

@QuicheSama
Copy link
Contributor

react-markdown-github depends on react-markdown but does not pass most react-markdown props down to it's dependent component. This prevents users from overriding properties to get the behavior, or access the features they need. This simply passes the props through.

CHANGELOG.md Outdated
# `react-markdown-github`

- Create prop pass-through to provide props to `react-markdown`
- Change `resolver` prop to `transformLinkUri` to be consistent with `react-markdown`
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please notate as **BREAKING**

Copy link

@dusave dusave left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Once you've updated the CHANGELOG, 👍

Copy link
Contributor

@indexzero indexzero left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's avoid adding new dependencies like rip-out if we can do this in pure JSX.

src/index.js Outdated
'renderers',
'transformImageUri',
'transformLinkUri'
);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you do the spread first in JSX this shouldn't be necessary, right? e.g.

render() {
  const renderers = {
    heading: this.renderHeading,
    ...this.props.renderers
  };	     

  return <ReactMarkdown { ...this.props }
    renderers={ renderers }
    transformLinkUri={ this.transformLinkUri }
    transformImageUri={ this.transformImageUri } />;
}

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, that would work now. Originally, I suggested that to be able to override the transformLinkUri and transformImageUri calls, but that’s no longer needed since they’re called as callbacks in those functions. Let’s do it that way, as long as we don’t change it in the future to not allow the user to provide their own override of a prop.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed. @QuicheSama please update this to use the JSX spread technique outlined in my previous comment.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed in 46b0158

@indexzero indexzero merged commit 15ac4b4 into godaddy:master Jul 24, 2018
@QuicheSama QuicheSama deleted the prop-passthru branch July 24, 2018 18:34
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants