Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Made Markdown wrapper overrideable #5946

Merged
merged 1 commit into from
Feb 15, 2022
Merged

Conversation

MikeKingdom
Copy link
Collaborator

What does this PR do?

Currently any wrapper specified in the Markdown options parameter gets ignored since Markdown forces it to be a Fragment. This change will honor a wrapper specified in options, if any.

Where should the reviewer start?

Markdown.js

What testing has been done on this PR?

A custom storybook example, plus a Jest case added

How should this be manually tested?

const Wrapper = props => <Box gap="small" {...props} />;
...
<Markdown
  options={{ wrapper: Wrapper }}
  components={{
    p: { 
      component: Paragraph,
      props: { margin: 'none' },
    },
  }}
>
  {'first paragraph\n\nsecond paragraph'}
</Markdown>

Do Jest tests follow these best practices?

  • screen is used for querying.
  • The correct query is used. (Refer to this list of queries)
  • userEvent is used in place of fireEvent.
  • asFragment() is used for snapshot testing.

Any background context you want to provide?

What are the relevant issues?

#5832

Screenshots (if appropriate)

Do the grommet docs need to be updated?

No

Should this PR be mentioned in the release notes?

Yes

Is this change backwards compatible or is it a breaking change?

Backwards compatible

@ericsoderberghp ericsoderberghp merged commit 4d55f86 into master Feb 15, 2022
@ericsoderberghp ericsoderberghp deleted the markdown-wrapper branch February 15, 2022 00:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants