storybook: [5.0.0] addon-info does not render code snippet markdown given on the text parameter

Describe the bug After upgrading to 5.0.0, addon-info does not render any code snippets given via the text key on the info parameter on the addParameter() function. It successfully displays all the given text but fails and does not display the given code under the ~~~ ~~~ notation, i.e:

\~~~js
  function something(a) {
    return a;
  }
\~~~

To Reproduce Steps to reproduce the behavior:

  1. Go to any story, put any string with aforementioned ~~~js ~~~ markdown notation
  2. View it on the storybook
  3. See that the supposed code snippet does not show at all.

Expected behavior The supposed code snippet should show correctly as before

Screenshots screen shot 2019-03-06 at 16 55 35

Code snippets screen shot 2019-03-06 at 16 55 24

System:

  • OS: MacOS Mojave, also does not work on netlify deployment
  • Device: Macbook Pro 2017
  • Browser: Chrome
  • Framework: React
  • Addons: addon-info
  • Version: 5.0.0

Additional context none

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 32
  • Comments: 16 (1 by maintainers)

Most upvoted comments

This needs to be merged ASAP.

Boo-yah!! I just released https://github.com/storybookjs/storybook/releases/tag/v5.2.0-alpha.29 containing PR #6016 that references this issue. Upgrade today to try it out!

You can find this prerelease on the @debug NPM tag.

Closing this issue. Please re-open if you think there’s still more to do.

This is a rather urgent problem that I feel deserves more attention, so bumping a bit.

Fix this plx!

Hi all, still no news about this issue? It would be great to have it fixed…

Yes the issue still exists…

For the sake of helping to weight this issue and keep it fresh: Having the same issue upgrading from storybook 4 to 5. I even tried the markdown example from the README and it is also not working. https://github.com/storybooks/storybook/tree/master/addons/info#markdown

Here are some clues I found:

This line should maybe changed to:

const Code = (props) => {
  const { language, code } = props

  return (
    <SyntaxHighlighter
      bordered
      copyable
      language={language}
    >
      {code}
    </SyntaxHighlighter>
  );
};

But then this line (and other lines will probably too) results in:

Cannot read property 'bar' of undefined

Which tells me components consuming the theme aren’t up to date with the latest themes found here.

May anyone pick it up from here?