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

Info description strings containing React components get rendered as React components #2207

Closed
danielduan opened this issue Nov 1, 2017 · 4 comments

Comments

@danielduan
Copy link
Member

danielduan commented Nov 1, 2017

If I pass in a React component to withInfo(markdown)

const markdown = `
~~~js
  // source file for button
  <Button />;
~~~
`;

This will actually render <Button /> into <button></button>

workaround is to escape the <

caused by marksy: storybookjs/marksy#26

@Hypnosphi
Copy link
Member

Hypnosphi commented Nov 5, 2017

workaround is to escape the <

Should we do it on our side maybe?

@danielduan
Copy link
Member Author

If there's a desire on our side to maintain something like that, I don't see why not.

Basically something like if string is wrapped inside '~~~' and has tag, escape the open?

@Hypnosphi
Copy link
Member

No, there are multiple ways to add code blocks in markdown, so it doesn't look such a good idea to me now.

So I would pick one of the options:

  1. Apply the highlight workaround I mentioned here: Should skip rendering custom components inside code block marksy#26 (comment)
  2. Migrate to react-markdown, which has a similar API

@Hypnosphi
Copy link
Member

Looks like we have a third option here =)
storybookjs/marksy#26 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants